0 TOTALS IN SUBREPORTS

  • Thread starter Thread starter BobH
  • Start date Start date
B

BobH

I have a report with 15 subreports that total different
fields of my application. What can I do to print a Zero
(0) where there is no information for the subreport to
calculate.
I've looked for default settings and a way to write some
script but so far I have no luck with either.

Any and all assistance will be greatly appreciated.

Bob Hightower
 
Try wrapping the field that's being summed with Nz function:

=Sum(Nz([FieldName], 0))
 
To borrow from Allen Browne's response
=IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report].[Text1], 0), 0)
 
Ken said:
Try wrapping the field that's being summed with Nz function:

=Sum(Nz([FieldName], 0))


NZ won't get a chance to do anything when the subreport has
nothing to sum. Actuall subreport are totally suppressed
when there is no data for it to process.

This must be dealt with in the main report by making a label
control with a caption of "0" visible or not:

Me.lblZero1.Visible = Not Me.subreport.Report.HasData

you may also need to set the subreport control too:

Me.subreport1.Visible = Me.subreport.Report.HasData
 
Thanks, Marsh.

--
Ken Snell
<MS ACCESS MVP>

Marshall Barton said:
Ken said:
Try wrapping the field that's being summed with Nz function:

=Sum(Nz([FieldName], 0))


NZ won't get a chance to do anything when the subreport has
nothing to sum. Actuall subreport are totally suppressed
when there is no data for it to process.

This must be dealt with in the main report by making a label
control with a caption of "0" visible or not:

Me.lblZero1.Visible = Not Me.subreport.Report.HasData

you may also need to set the subreport control too:

Me.subreport1.Visible = Me.subreport.Report.HasData
 
Ken said:
Thanks, Marsh.

Sorry Ken, that was supposed to be a reply to BobH. I guess
I mentally combined both your reply and his post into the
common question of why doesn't NZ take care of the problem.
 

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

Back
Top