Question : Access Report - Totalling group header calculation

I have a query-based report which lists purchased items required on an assembly. It's grouped by supplier and then by part number for purchasing purposes.

The part number group has calculations for the total quantity required which is compared to the 'minimum purchase qty' and adjusted if needed. i.e. if the qty required is less than the minimum qty then we must order the minimum order qty. The corresponding cost is then calculated as follows:

=IIf ([purchase_qty] < [min_qty] , [min_qty] , [purchase_qty]) * [unit_price]

This can only be calculated at the group header level as it's the group total qty used in the formula. This is fine until I come to calculate the grand total cost at the bottom of the report.. I need to total the calculated fields from the group header but it totals from every detail record of course.

I have attached a screenshot of the report with the incorrect grand total highlighted at the bottom (I just added the sum of the above formula just to see what happened). Can anyone help me calculate the correct total please?
Thanks.
Attachments:
 
Purchasing report with incorrect total cost
Purchasing report with incorrect total cost
 

Answer : Access Report - Totalling group header calculation

Hi nigelr99,

One trick to obtain a total of a calculated field in group footers and headers is to use “running sum”. Please try to duplicate your field with the expression, and set the property “running sum: yes” for the copy. Verify that it does indeed cumulate the amounts you want, and that it shows the correct total on the last header.

Say this new text box is called txtRunningSum, you can then add a new text box in the report footer with the expression

    = txtRunningSum

It will display the last available value from that text box. Once it works satisfactorily, you can hide the actual running sum.

Cheers!
(°v°)
Random Solutions  
 
programming4us programming4us