How to: Add a Subreport and Parameters (Report Designer)

You can embed one report within another. The embedded report is called a subreport. The report that you embed is independent of the report that contains it. To relate the reports through data values (for example, to have both reports show data for the same customer), you must pass parameters from the containing report to the subreport. The report that you are embedding must have parameters already defined for it.

To add a subreport

  1. In Layout view, in the Toolbox, click Subreport.

  2. On the design surface, drag a box to the size you want the subreport to be. Alternatively, click the design surface to create a subreport of fixed size.

    Note

    If the subreport exists in the project, you can drag the report from Solution Explorer onto the design surface to create a subreport.

  3. Provide a path to the report server where the subreport is published. Right-click on the subreport, and then click Properties. On the General tab, in the Name property, the subreport path should be specified as follows:

    • For a report published to a report server configured for native mode, use a full or relative path without the file name extension. If the report is in the same folder as the current report, use the name of the report only. If the report is in a different folder on the same report server, use a relative path to the report (for example, .../Folder2/Report1). If the report is on a different report server, use the full path to the report server and report (for example, http://server1/Folder3/Report2).
    • For a report published to a report server configured in SharePoint integrated mode, use a fully qualified URL including the file name extension. Relative paths are not supported. For example, http://<SharePointservername>/<site>/Documents/Report1.rdl.

To pass parameters to a subreport

  1. In Layout view, right-click the subreport and then click Properties.

  2. On the Parameters tab, do the following:

    • In Parameter Name, type the name of a parameter in the subreport. This name must match a report parameter in the report named in the ReportName property.

      Note

      The parameter name must match the name of a report parameter, not a query parameter.

    • In Parameter Value, type a value to pass to the subreport. This value can be static text or an expression pointing to a field or other object in the parent report.

  3. Repeat step 2 to add additional parameters to pass to the subreport.

    Note

    All parameters that are required by the subreport must be included in the Parameters list. If a required parameter is missing, the subreport is not displayed correctly within the parent report.

See Also

Concepts

Adding a Subreport
Report Designer How-to Topics
Designing the Report Layout
Rendering Considerations for Automatic Sizing and Positioning
Deployment Modes for Reporting Services

Other Resources

Subreport Properties (General Tab, Report Designer)
Tutorial: Advanced Features Using Parameters

Help and Information

Getting SQL Server 2005 Assistance