I am currently launching a crystal report from within VB, which contains several subreports. The main report and subreports are all using different SQL statements to retrieve the data they need for the report.
I have managed to get the main report working using the following code:-
sqlstr1 = "select * from report1 where month = " & Month(reportdate) & " and year = " & Year(reportdate)
CrystalRS.Open sqlstr1
Set cAppn = CreateObject("CrystalRunTime.Application"
Set cReport = cAppn.OpenReport(".\Reports\Report1.rpt"
ReportsViewFrm.CRViewer91.ReportSource = cReport
cReport.DiscardSavedData
cReport.Database.Tables.Item(1).SetLogOnInfo "SQL", "DB1", "sa", "ssid"
cReport.Database.Tables.Item(1).SetDataSource CrystalRS
This allows me to see the data for the main part of the report but does anyone know a way of specifying the individual data sources for the subreports?
Thanks in advance.
Rob
I have managed to get the main report working using the following code:-
sqlstr1 = "select * from report1 where month = " & Month(reportdate) & " and year = " & Year(reportdate)
CrystalRS.Open sqlstr1
Set cAppn = CreateObject("CrystalRunTime.Application"
Set cReport = cAppn.OpenReport(".\Reports\Report1.rpt"
ReportsViewFrm.CRViewer91.ReportSource = cReport
cReport.DiscardSavedData
cReport.Database.Tables.Item(1).SetLogOnInfo "SQL", "DB1", "sa", "ssid"
cReport.Database.Tables.Item(1).SetDataSource CrystalRS
This allows me to see the data for the main part of the report but does anyone know a way of specifying the individual data sources for the subreports?
Thanks in advance.
Rob