We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


CR 2008 Sub-reports sometimes omit data

Medium Priority
Last Modified: 2012-05-06
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
'  Logic
'    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.

Open in new window

Watch Question

Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

I have never seen this.

Does it happen when you just run a report?



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 does seem to happen significantly more often (but not exclusively) if I am swapping between reports quickly.
I wasn't properly disposing of my reports (something my speed tests eventually revealed) - while I'm not 100% sure why missing a dispose caused blank sub-reports, properly disposing seems to have eliminated the problem.

Thanks for reading.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

I meant does it ever happen when you just run 1 report, no swapping between reports.

Glad you resolved it.

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.