Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Totals in a group footer

Status
Not open for further replies.

strangeryet

Programmer
Jul 8, 2004
159
US
Hello,
My report has an amount field on each detail line.
The report is grouped by another field on the detail line. How can I (at the end of each group) sum the amounts together in the group footer and then at the end of the entire report give a grand total?
Thanks
 
Theoretically you can using the running sum property at each grouping and report total level, where you select the same field for each control, but also select running sum over group or running sum over all.

I've had problems using this method in the past, so I do it the manual way (which also requires checking). In your detail set up VBA code to add the detail value (for each control) to the grouping control and the report total control. At the grouping header, set the grouping control to zero. At the open report set the report total control to zero. If you do this for all of the controls you want to totale you should get accurate values. The main trick is to place these calculations in the correct property, normally the OnPrint property. If the detail area of the report is hidden, then the detail calculations need to be run for the OnFormat property of the detail section.

Bob
 
90% of the reports that need group and report totals do not require running sums. IMHO, 100% of the reports that need group and report totals should never use VBA to calculate totals.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top