LOCAL lcCID, ; oRE * Create an instance of the report engine oRE = createobj('reportengine') With oRE * Read reports path from Application object .cReportFilePath = This.oApplication.cOutputPath * Set report engine connection handle .ODBChdbc = SQLGetProp( 1 , 'ODBChdbc' ) lcCID = V_CASE.cID If ! .OpenReport('IndictmentJacket.rpt') Messagebox(.cErrorMessage,MB_ICONSTOP,'Report Error') ELSE .SetReportParameter('vp_ccase_cid', lcCID) **************************** ** From Dan Jurden ** get a reference to the sections collection of the main report *loSections = loReport.Sections loSections = oRe.oreport.Sections ** Go through each section in the main report... FOR EACH loSection IN loSections ** Get all the objects in this section... loReportObjects = loSection.ReportObjects ** Go through each object in the reportobjects for this section... FOR EACH loReportObject IN loReportObjects ** Find the object which is the SubreportObject IF loReportObject.Kind = 5 && crSubreportObject ** Found a subreport, now get a hold of it loSubReportObj = loReportObject ** Open the subreport and treat it as any other report loSubReport = loSubReportObj.OpenSubreport ************************************************** ** set the parameter in the sub-report here ** loSubReport.SetReportParameter('vp_ccase_cid', lcCID) ************************************************** ENDIF NEXT NEXT ************************************************** .Preview() ENDIF ENDWITH>Do something like this:
>** get a reference to the sections collection of the main report
>loSections = loReport.Sections
>
>** Go through each section in the main report...
>FOR EACH loSection IN loSections
> ** Get all the objects in this section...
> loReportObjects = loSection.ReportObjects
>
> ** Go through each object in the reportobjects for this section...
> FOR EACH loReportObject IN loReportObjects
> ** Find the object which is the SubreportObject
> IF loReportObject.Kind = 5 && crSubreportObject
> ** Found a subreport, now get a hold of it
> loSubReportObj = loReportObject
> ** Open the subreport and treat it as any other report
> loSubReport = loSubReportObj.OpenSubreport
>
> **************************************************
> ** set the parameter in the sub-report here **
> **************************************************
>
> ENDIF
>
> NEXT
>
>NEXTThanks,
TFISHER