I am using VB6 / Crystal 8 ocx and am having a problem getting some subreports to display. I have a report that is made up of various subreports (8) and they make a 2 page report. The reports are built against a table in SQL Server so I need to change the table name / db name at runtime. The problem appears to come into play when I try to change the location / name of the table and DB. When the report is displayed in VB the navigation controls show page 1 of 1+ and the viewer is not allowing me to move to the second page. Any thoughts? The code works on most reports so I am confused.
It also occurs when I have a subreport in a footer and set the "New Page After" property.
Here is a sample of the code I am using:
With objfrmCrystalView.crptReportViewer
.ReportFileName = App.Path & "\Reports\TopNReport.rpt"
' connect report to DB Server
.Connect = "dsn= " & guser_UserInfo.DSN & _
";uid= " & CRYSTAL_TRUSTED_ACCOUNT & _
";dsq=" & guser_UserInfo.Database
.LogOnServer "pdssql.dll", guser_UserInfo.DSN, guser_UserInfo.Database, "", ""
.DataFiles(0) = strDetailTable(DETAIL_TABLE)
.DataFiles(1) = strHeaderTable
.SubreportToChange = "ProviderCriteria"
.Connect = "dsn= " & guser_UserInfo.DSN & _
";uid= " & CRYSTAL_TRUSTED_ACCOUNT & _
";dsq=" & guser_UserInfo.Database
.LogOnServer "pdssql.dll", guser_UserInfo.DSN, guser_UserInfo.Database, "", ""
.DataFiles(0) = strDetailTable(PROV_SPEC_TABLE)
.SubreportToChange = ""
'fire off report
.WindowParentHandle = objfrmCrystalView.hWnd
.WindowState = crptMaximized
.WindowAllowDrillDown = False
.Action = 1
.DiscardSavedData = True
End With
It also occurs when I have a subreport in a footer and set the "New Page After" property.
Here is a sample of the code I am using:
With objfrmCrystalView.crptReportViewer
.ReportFileName = App.Path & "\Reports\TopNReport.rpt"
' connect report to DB Server
.Connect = "dsn= " & guser_UserInfo.DSN & _
";uid= " & CRYSTAL_TRUSTED_ACCOUNT & _
";dsq=" & guser_UserInfo.Database
.LogOnServer "pdssql.dll", guser_UserInfo.DSN, guser_UserInfo.Database, "", ""
.DataFiles(0) = strDetailTable(DETAIL_TABLE)
.DataFiles(1) = strHeaderTable
.SubreportToChange = "ProviderCriteria"
.Connect = "dsn= " & guser_UserInfo.DSN & _
";uid= " & CRYSTAL_TRUSTED_ACCOUNT & _
";dsq=" & guser_UserInfo.Database
.LogOnServer "pdssql.dll", guser_UserInfo.DSN, guser_UserInfo.Database, "", ""
.DataFiles(0) = strDetailTable(PROV_SPEC_TABLE)
.SubreportToChange = ""
'fire off report
.WindowParentHandle = objfrmCrystalView.hWnd
.WindowState = crptMaximized
.WindowAllowDrillDown = False
.Action = 1
.DiscardSavedData = True
End With