Problem with Sum on subreport

M

Max Moor

Hi All,
I have a report containing a subreport. I use the Sum function in a
text box on the subreport to total some values. I then report the total on
the main form by refering to this box.
This all works fine, unless there are no records in the subform
(which happens with some regularity). What I need is a way to return 0 if
there are no records. I tried wrapping the reference to the subform's text
box in an Nz() call, but to no avail.
Can someone show me the way?

- Max
 
A

Allen Browne

Test the HasData property of the subreport.

Assuming a subreport named "Sub1":

=IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report].[Text1], 0), 0)
 
M

Max Moor

Test the HasData property of the subreport.

Assuming a subreport named "Sub1":

=IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report].[Text1], 0), 0)

Geez, I didn't know there was one (obviously). Thanks, Allen.

- Max
 
Top