Adding a Subreport

A subreport is a report item that displays another report inside the body of a main report. Conceptually, a subreport is similar to a frame in a Web page. It is used to embed a report within a report. Any report can be used as a subreport. The report that the subreport displays is stored on a report server, usually in the same folder as the parent report. You can set up the parent report to pass parameters to the subreport. A subreport can be repeated within data regions, using a parameter to filter data in each instance of the subreport.

If you have used subreports in the past to display separate groups of data, consider using data regions (tables, matrices, lists, or charts) instead. Reports with data regions instead of subreports may perform better than reports that include subreports. When you run a report that contains a subreport, the report server has to process each report. If the report contains data regions instead, the report server processes only one report.

Use data regions when you need to nest groups of data from the same data source within a single data region. Use subreports if you need to nest groups of data from different data sources within a single data region, reuse a subreport in multiple parent reports, or display a standalone report inside of another report. You can create a "briefing book" by placing multiple subreports inside the body of another report.

Note

In Report Designer, if you preview a report that contains subreports, and then change the subreport, the preview may not be updated. To see the changes, click the Refresh button.

Using Parameters in Subreports

To pass parameters from the parent report to the subreport, define a report parameter in the report that you use as the subreport. When you place the subreport in the parent report, you can select the report parameter and a value to pass to the report parameter.

Note

The parameter that you select from the subreport is a report parameter, not a query parameter. For more information about parameters, see Working with Parameters in Reporting Services.

You can place a subreport in the main body of the report, or in a data region. If you place a subreport in a data region, the subreport will repeat with each instance of the group or row in the data region. To pass a value from the group or row to the subreport, in the subreport value property, use a field expression for the field containing the value you want to pass to the subreport parameter.

To view instructions about working with subreports, see How to: Add a Subreport and Parameters (Report Designer).

See Also

Concepts

Designing the Report Layout

Help and Information

Getting SQL Server 2005 Assistance