FAQ: How do I preview a Subreport which is in another SSRS project?

Question 

Saying in Design mode, I have one report in a SSRS project and I would like to display another report which is in another SSRS project when preview the main report. But when I preview the report, I encountered an error like the following:

/DemoTest2/Product Detail cannot be compiled. Verify the report name and that the report is in the current project.

How can I resove this issue?

 Answer

To preview the subreport, you have to first deploy your report project which contains the subreport to your report server. If you choose "Go to Report" for the subreport, you also need to deploy your main SSRS project to the report server and then specify the relative path. In this scenario, the subreport's name will not be displayed in the drop-down list of Select a report from the list when you design the main report. You have to manually type in the relative subreport path in the drop-down list. For example, your two SSRS projects are deployed to the report server as following structure:

 

Then you can configure the subreport settings as follows:

  • 1. On your main report, right-click the textbox you want to add an action, and then select Text box Properties... button.
  • 2. Switch to the Action tab, type in the relative report path in the drop-down list of Select a report from the list, such as ../DemoTest2/Product Detail:

 

 

  • 3. If the subreport has parameters, you can click the Add button to add parameters into the parameter grid.
  • 4. You need to hard code the Parameter Name in the Name drop-down list, as these parameters are not contained in the name drop-down list.
  • 5. In the Value drop-down list, select a value to pass to the subreport.
  • 6. Repeat steps 3-5 to specify a value for each subreport parameter.
  • 7. Click OK.
  • 8. Deploy the report project and preview it.

 This method applies to Sql Server Reporting Service2005, Sql Server Reporting Service2008 and Sql Server Reporting Service2008 R2.