Last Updated: March 13, 2018
·
16.56K
· petermorlion

Forcing a SSRS subreport to show

In SSRS, when the dataset of a subreport contains no data, the subreport won't show in your main report. You can use the NoRows property of in the main report to show a message, but maybe you want the controls of your subreport to be visible (the table headers,...)

The following hack can achieve this:

Add a new DataSet to your subreport

Choose a DataSource (even though we won't use it) and set the following as query:

SELECT ' ' AS DUMMY

Or for Oracle (PL/SQL):

SELECT ' ' AS DUMMY FROM DUAL

Now add a Textbox to your subreport and set its value to:

=First(Fields!DUMMY.Value, "DataSetToForceSubreportVisibility")

Leave the textbox as visible or it won't work (at least, it didn't for me). That's why I took an empty string and not a number (i.e. SELECT 1).

Now, even when your main DataSet doesn't have data, your subreport will have data and so your subreport will always be visible.

3 Responses
Add your response

Thank you =, This saved me a ton of wailing and gnashing of teeth.

over 1 year ago ·

Glad to help!

over 1 year ago ·

thank you so much, it works perfectly
and your explanation is easy and clear !!!

over 1 year ago ·