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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programmatically discovering subreport properties

Status
Not open for further replies.

BruceMorgan

Programmer
Jul 5, 2001
3
US
Is there a way to programmitcally retrieve information about a subreport from the main report? The only method I've seen for opening a subreport assumes that I know that the report has a subreport, and that I know the subreport's name and linked fields.
 
Hi,

The code below looks for all the sub report in the main
report.This might be of help to you.

Dim Report As CRAXDRT.Report
Dim Application As New CRAXDRT.Application
Dim sReportObjects As CRAXDRT.ReportObjects
Dim subReport As CRAXDRT.Report
Dim crxSections As CRAXDRT.Sections
Dim crxSection As CRAXDRT.Section
Dim ReportObject As Object
Dim crxReportObjects As CRAXDRT.ReportObjects
Dim sReport As CRAXDRT.SubreportObject

Set Report = Application.OpenReport(sRptName)
Set subReport = Report
Set crxSections = subReport.Sections
For Each crxSection In crxSections
Set crxReportObjects = crxSection.ReportObjects
For Each ReportObject In crxReportObjects
If ReportObject.Kind = crSubreportObject Then
Set sReport = ReportObject
Set subReport = sReport.OpenSubreport
End If
Next
Next
I am sure this is the way to go..Hope this helps..Thanks Murali Bala
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top