Crystal Reports XIr2 SubReports and VB.NET 2005?

Quick question about Subreports in VB.NET 2005 with CRXIr2. Below is some simple basic code to just print out a report that has 5 subreports in it.

Dim crReport As New rptTestInfo
crReport.SetDataSource(dsTestInfoReport)
crReport.PrintToPrinter(1, False, 0, 0)

Up farther in the code I connect to the database. Run my query and get back the info I need.

dsTestInfoReport.Clear()

'Make your connection to the database (change location), and fill the Dataset
daTestInfoReport = New SqlDataAdapter(stQuery, cnMyConnection)

daTestInfoReport.Fill(dsTestInfoReport.TestInfoReport)

Ok this all works great. Except when I run multiple reports the main report does not refresh subreports with new data. So what ever you printed first it prints the same thing know matter how many reports you print. The other odd thing on the main report I have to specify a datasource.

When I use this same concept on our Crystal Reports Server. It populates all the subreports with the new data everytime. Plus in the main report I do not have to specify a datasource.

All datasources are on the subreports. I realize I am using a straight database connection with the CR server and a dataset with VB.NET. However I do need it to work like CR Server or the user has to wait for all 5 single reports to print.

Any Ideas..




Answer this question

Crystal Reports XIr2 SubReports and VB.NET 2005?

  • Crystal Reports XIr2 SubReports and VB.NET 2005?