Grand totals in reports

  • Thread starter Thread starter jennifer
  • Start date Start date
J

jennifer

I have a report that is grouped. I would like to add a running total to the
bottom of the page. Right now I have a field that is being caculated by
=[sumofamount]-[sumofcurr dedn]. Is there any way to have it grand total
these calculations at the end? Thanks.
 
Assuming the columns being summed are called [amount] and [curr dedn] for a
grand total at the end of the report you can add a text box to the report
footer with a ControlSource property of:

=Sum([amount])-Sum([curr dedn])

For a cumulative running total at the bottom of each page add an unbound
text box, txtPageTotal say to the page footer and in the report header's
Print event procedure initialise it to zero:

Me.[txtPageTotal] = 0

In the detail section's Print event procedure increment it, examining the
PrintCount property to avoid any inadvertent double counting:

If PrintCount = 1
Me.[txtPageTotal] = [txtPageTotal] + (Me.[amount]-Me.[curr dedn])
End If

This will of course also give a grand total at the end of the report in the
final page footer, so you can do without the grand total in the report footer
if you wish, or you can keep that and hide the control in the page footer on
the final page by putting the following in the page footer's Format event
procedure:

Me.[txtPageTotal].Visible = (Page < Pages)

For this last method to work you need to reference the Pages property in a
control, so, if this is not already being done in a control, add another text
box to the page footer, set its Visible property to False (No) and its
ControlSource property to:

=Pages

Ken Sheridan
Stafford, England
 

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