|
-
May 8th, 2004, 02:53 PM
#1
Thread Starter
Member
subreport problem
Can u have multiple subreports in one report?
If so how do u set the datasource?
Dim DSOrders As New MDataset()
filldataset(DSOrders)
Dim RD As New MainReport() ' this is the mainreport.rpt
Dim RO As CrystalDecisions.CrystalReports.Engine.ReportObject
Dim SRO As CrystalDecisions.CrystalReports.Engine.SubreportObject
Dim SubDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument
RO = RD.ReportDefinition.Sections.Item("Section3").ReportObjects.Item("Subreport1")
SRO = CType(RO, CrystalDecisions.CrystalReports.Engine.SubreportObject)
SubDoc = SRO.OpenSubreport(SRO.SubreportName)
SubDoc.SetDataSource(DSOrders)
This works for the 1st subreport if there is only one subreport.
I tried the same code with different variable names for the 2nd subreport and it displayed the 2nd report right and the 1st subreport came back empty.
What is the best method to have multople subreports in a report?
Each subreport is from different tables.
Any help appreciated
thanks
-
May 10th, 2004, 10:34 AM
#2
Hyperactive Member
Sorry but I don't understand how do you access the external data...
but anyway here it is what I do.
I have several reports that have several SubReports (Graphics specifically), and for example, in one that I have 3 SubReports I do the Following:
VB Code:
Report.Subreport1.OpenSubreport.Database.SetDataSource rsGraph1
Report.Subreport2.OpenSubreport.Database.SetDataSource rsGraph2
Report.Subreport3.OpenSubreport.Database.SetDataSource rsGraph3
That's it.
The SubReports have the data!
Hope this helps!
"Who Dares Wins" - "Quien se Arriesga Gana"
Mail me at: 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|