Subreports: What they are and how they work

Subreports: What they are and how they work

A subreport is a report that's inserted in another report. When you combine reports, one of them must serve as the main report. A main report is either bound or unbound; that is, it is or isn't based on a table, query, or SQL statement.

Data from unrelated record sources in a main report with two subreports

An unbound main report can serve as a container for unrelated subreports that you want to combine.

Unbound main report with two subreports displaying unrelated data

Data from one record source in a main report and subreport

You bind the main report to an underlying table, query, or SQL statement when you want to insert subreports that contain information that's related to the data in the main report. For example, you can use the main report to show detail records, such as every sale in a year, and then use a subreport to show summary information, such as the total sales for each quarter.

Main report and subreport bound to the same record source

Data from related record sources in a main report and two subreports

A main report can also contain data common to two or more parallel subreports. In this case, the subreports contain the detail records related to the common data.

Main report with two subreports displaying related data

A main report can include subforms as well as subreports, and it can include as many subforms and subreports as you want. Additionally, a main report can contain up to two levels of subforms and subreports. For example, a report can contain a subreport, and that subreport can contain a subform or a subreport. The following table shows the possible combinations of subforms and subreports in a main report.

Level 1 Level 2
Subreport 1 Subreport 2
Subreport 1 Subform 1
Subform 1 Subform 2

Note   The Sales by Category and Sales by Year reports in the Northwind sample database use subreports. To view these reports, open the Northwind database in the Samples subfolder of your Office folder, and then open the report in Design view. For information on opening Northwind, click .