In section reports, you can use the SubReport control to embed a report into another report. There are two (2) ways to select a report to display within the SubReport control:
You can also pass parameters to the subreport from the main report so that data related to the main report displays in each instance of the subreport.
Remove page-dependent features from reports to be used as subreports
Subreports are disconnected from any concept of a printed page because they render inside the main report. For this reason, page-dependent features are not supported for use in subreports. Keep any such logic in the main report. Page-related concepts that are not supported in subreports include:
Coding best practices
Use the ReportStart event of the main report to create an instance of the report for your SubReport control, and then dispose of it in the ReportEnd event. This way, you are creating only one subreport instance when you run the main report.
In the Format event of the containing section, use the Report property of the SubReport control to attach a report object to the SubReport control.
Clicking the SubReport control reveals its properties in the Properties panel.
Property | Description |
---|---|
CanGrow | Determines whether ActiveReports increases the height of the control based on its content. |
CanShrink | Determines whether ActiveReports decreases the height of the control based on its value. |
CloseBorder | By default, the bottom border of the control does not render until the end of the subreport. Set this property to True to have it render at the bottom of each page. (Only available in code) |
ReportName | Specifies the name of the subreport with the <From File...> option that opens the Open dialog. |
With the control selected on the report, in the Commands section at the bottom of the Properties panel, you can click the Property dialog command to open the dialog.
To use the SubReport control in your report, you must create two reports - one parent and one child report. Then, after dragging the SubReport control onto the parent report, you need to either select a report to display within the SubReport control or add code to create an instance of the child report in the parent report, and another code to display the child report in the SubReport control on a parent report.
For details on working with SubReport control in section reports, see Work with Subreports.