Subreport On No Data

J

Jane

Hello everyone,

I have a report with 2 subreports.
On each sub report is a sum total in the report footer
On the main report is a calculated box that adds the 2 subreport totals.

If either of the sub reports has no data the main report shows Error.
I have tried Nz function on all sums (on the sub and main reports) but this
does not help.

Can anyone help with this problem.

Thank you

Jane Hollin
 
W

Wayne-I-M

Use this on your main form

= IIf(SubReport_1_Name.Report.HasData,
SubReport_1_Name.Report!ControlName,0) + IIf(SubReport_2_Name.Report.HasData,
SubReport_2_Name.Report!ControlName,0)

Change the names to what they really are.

Basically you are checking if the subreport "HasData" and it a true or false
like most IIF's
In this case if it's true (has data) then you add the control name - if it's
false you add 0


HtH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top