Tuesday, 21 February 2012

How to hide sub report if no data for sub report in sql server report

If you get the error message "Subreport could not be shown", the issue should be caused because the subreport fails. By default, if there is no data returned in the sub reports, the subreports on main report should show empty or nothing, also, you can specify text to promt the users by setting the subreport's NoRowsMessage property.



Just had this problem and found solution was to make sure the data source for parameters was the same in all reports.
ie at top level report was populating all companies that returned any type of result into drop down for parameter selection
At each sub report was only returning companies that had data for that report.
Result was at top level if I selected a company that did not appear in the drop down of the sub report error occured.
Fixed by making data query for drop down list the same for each sub report

Reference:
http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/109b01fe-2c5a-458b-88c7-98d8ee97ba4d/

No comments:

Post a Comment