How to make calculatoins with fields form subreports

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.
 
D

Duane Hookom

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?
 
A

Allen Browne

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.
 

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

Top