purektm
asked on
CR 2008 Sub-reports sometimes omit data
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.
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
' Logic
' Col0.Value = -1, 0, or some positive Integer
ParamField0.Name = "Col0"
ParamField0.CurrentValues.Add(Col0)
ParamFields.Add(ParamField0)
Me.myCrystalReportViewer.ParameterFieldInfo = ParamFields
Dim reportPath As String = Application.StartupPath & "\" & "CRReport.rpt"
Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument
rpt.Load(reportPath)
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.
BugReport.JPG
ASKER
I guess I'm not 100% clear on what you're asking.
It happens when I simply generate a report with my program, though there are several processes at work there (as outlined above).
It happens when I simply generate a report with my program, though there are several processes at work there (as outlined above).
ASKER
It does seem to happen significantly more often (but not exclusively) if I am swapping between reports quickly.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I meant does it ever happen when you just run 1 report, no swapping between reports.
Glad you resolved it.
mlmcc
Glad you resolved it.
mlmcc
Does it happen when you just run a report?
mlmcc