How to make calculatoins with fields form subreports

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have a report with 8 subreports Each subreport alculates totals of a
certain field. I need to make a final calculation on the main report at the
end with the previously "calculated fields" from subreports.

Any idea of how to do it ? thanks for your help.
 
Is there only one instance of each of the subreports to total? What have you
tried? Is there a possibility that some of the subreports may not return any
records?
 
Place a text box on your report, in the section that contains the subreport.

Set its ControlSource to something like this:
=IIf([Sub1].[Report].[HasData], Nz([Sub1].[Report].[Text1], 0), 0)
substituting the name of your subreport control for "Sub1", and the name of
your text box for "Text1".

Set the Running Sum property of this text box to:
Over All

It will accumulate the total, and you can then pick it up at the end of the
report.


Explanation:
If a subreport has no data, referring to the non-existent text box in the
subform generates an error. That's why we test the HasData property of the
report in the subreport control.

The Running Sum is the only reliable way to get Access to calculate
progressive totals over several pages. Calculations performed in the events
of the report are not reliable, as they may not execute if not all pages are
viewed/printed.
 
Back
Top