Summary: Sometimes sub-reports get all of the necessary parameters, but don't populate data.
I am using Crystal Reports 2008 to report data from a MS Access database in a VB2005 program.
When the form with my report viewer loads, it runs through the logic to set different parameters, which are then attached to the report viewer. The (main) report is then loaded.
The main report features 5 sub-reports, 4 of them identical, except for parameters passed along.
Now, the titles of the sub-reports are controlled via parameters (linked from main to sub). The sub-reports may be suppressed via parameters (in the main report). And the data in the sub-reports is controlled via parameters (database connection using linked parameters...).
The suppression works 100% of the time. The titles work 100% of the time. The sub-report data usually works, but every once in a while the body of one or more of the sub-reports goes missing.
I can usually recreate this by switching between different reports and opening one, close, open the other, close - repeating until one bugs. Hitting the "Refresh" button on the Crystal Report Viewer will fix that instance of the problem, but I'd like to eliminate it completely.
As it appears that the parameters are always getting where they need to go (the sub-reports titles feature the correct/current info) I'm not sure what code would be necessary.
Thanks in advance for the help.
Example Code to show Methodology:
Public ParamField0 As New CrystalDecisions.Shared.ParameterField
Public ParamFields As New CrystalDecisions.Shared.ParameterFields
Public Col0 As New CrystalDecisions.Shared.ParameterDiscreteValue
' Col0.Value = -1, 0, or some positive Integer
ParamField0.Name = "Col0"
Me.myCrystalReportViewer.ParameterFieldInfo = ParamFields
Dim reportPath As String = Application.StartupPath & "\" & "CRReport.rpt"
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
Me.myCrystalReportViewer.ReportSource = rpt
' The report itself uses a combination of its parameters and an Access Query to fill out the
' fields on the main form.
' The report looks at Col0. If it is -1, it suppresses one of the sub-reports, if not, it
' passes that parameter to that sub-report.
' The sub-report takes the value of Col0 and names the title accordingly.
' The sub-report accesses an Access table using Col0 (and other parameters) to
' filter results.