hello everyone.
I have a program that should display report let say from a date to date. but i am using string compare and not date compare. what is my problem is it is not displaying the correct output and always shows a dialog box that request parameter.
-how do i make so that the default parameter box not showing?
-how do i make the report display the output correctly?
-the connections always show "logon failed" and need to be refreshed everytime i want to display the report.
so here is my code
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class BKCictSpecsReport
Private Sub VotSubmitBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VotSubmitBtn.Click
'
Dim repDoc As New BkcictSpecCR 'Result is the report doc .rpt
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = BKCICTDatePicker1.Text
crParameterFieldDefinitions = _
repDoc.DataDefinition.ParameterFields
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("fromDate")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
crParameterDiscreteValue.Value = BKCICTDatePicker2.Text
crParameterFieldDefinitions = _
repDoc.DataDefinition.ParameterFields
crParameterFieldDefinition = _
crParameterFieldDefinitions.Item("toDate")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = repDoc
CrystalReportViewer1.Refresh()
End Sub
Private Sub VotReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim crSections As Sections
Dim crSection As Section
Dim crReportObjects As ReportObjects
Dim crReportObject As ReportObject
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
Dim crSubreportObject As SubreportObject
Dim crSubreportDocument As ReportDocument
Dim crDatabase As Database
Dim crTables As Tables
Dim aTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim repDoc As New BkcictSpecCR 'Result is the report doc .rpt
'For Each myTable In repDoc.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = Application.StartupPath & "\UTMPOSS4.accdb"
myLogin.ConnectionInfo.DatabaseName = Application.StartupPath & "\UTMPOSS4.accdb"
myTable.ApplyLogOnInfo(myLogin)
Next
crSections = repDoc.ReportDefinition.Sections
'loop through all the sections to find all the report objects
For Each crSection In crSections
crReportObjects = crSection.ReportObjects
'loop through all the report objects in there to find all subreports
For Each crReportObject In crReportObjects
If crReportObject.Kind = ReportObjectKind.SubreportObject Then
crSubreportObject = CType(crReportObject, SubreportObject)
'open the subreport object and logon as for the general report
crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
crDatabase = crSubreportDocument.Database
crTables = crDatabase.Tables
End If
Next
Next
CrystalReportViewer1.ReportSource = repDoc
End Sub
End Class
I have a form of 2 datetimepicker and a button, a crystalreportviewer also.
thanks for your help.