Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Data Source For Subreport

Status
Not open for further replies.

Rob2k2

Technical User
Oct 14, 2002
36
0
0
GB
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top