Calculating totals in Subreports when no data found

Fear Naught

Kevin
Local time
Today, 15:43
Joined
Mar 2, 2006
Messages
229
Firstly I have searched this forum for an answer and nothing that I have found quite answers my question.

I have a report with 2 sub-reports. In the footer of each sub-report there is a text box that calculates a value in the sub-report.

In the footer of the main report there are 3 text boxes of which 2 of them show the calcualated value from the footer of the sub-reports and the 3rd totals them up.

This works fine when there is data available in both sub-reports. I get "errors" when there is no data in one or both of the sub-reports. I have tried using the NZ() function to no avail.

I am assuming that it is because if there is no data the sub-report does not load and therefore the text box control in the footer can't be referenced.

Can anybody help please?

Thanks
 
Have you nz'd the totals text box on the suform footer?
 
You have to use the HasData method, there were samples posted here, I think they've all been deleted now, post back if you need help with the statements
 
I have used NZ() in the totals text boxes on the subforms but thanks anyway Ken

For Puzzled - what is the HasData method. I have tried using the "on nodata" event of the subform to force a 0 value on the subform text boxes to no avail.
 
Many thanks to "Puzzled". I used the HasData method and it now works. For others the control source of one of the text boxes in the footer of the main reports is like this:

Code:
=nz(IIf(rptProjectExpenses_subreport.Report.HasData,rptProjectExpenses_subreport.Report!txtTotalBillable,0),0)
 

Users who are viewing this thread

Back
Top Bottom