I have a report with multiple subreports displayed on it, for example:
Main Report
Revenues SubReport
Expenses SubReport
Other SubReport
I need a number from the Expenses SubReport to display on the main report before the Expenses SubReport is printed. To handle this, I added a suppressed copy of the Expenses SubReport in the header of the main report and am using a shared variable to retrieve the value. (I can't simply execute the Expenses SubReport stored procedure to do this from within the main report stored procedure as its already executing a stored procedure itself and SQL Server won't allow and EXEC of a stored procedure with an EXEC in it already). I've added a filter to the subreport as as to retrieve only the single summary line that contains the number I need.
This approach generally works very well. However, there are some cases where the value returned is a zero. If I adjusted the layout of the hidden subreport a bit the value will appear. Why is this? How can I guarantee that the number will appear correctly every time?
Thanks
Carl