In report, how to have a count return something other than null

H

Heidi

I have a subreport that holds a count of names at the end of the report that
I want to reference in the main report to add it. My problem is that
sometimes this subreport ends up being null - there aren't always entries.
Can i have the count give a value of zero if it is null so it doesn't give me
that #Error and screw up my counts in the main form? I tried nz, and iif
statment, etc but can't seem to make anything work.

Thanks!
 
A

Allen Browne

When there are no records in the subreport, nothing shows, and so trying to
refer to the non-existent text box generates #Error.

To avoid that, test the HasData property of the report in the subreport
control:
=IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report]![Text0],0), 0)
 
Top