sum in header

  • Thread starter Thread starter debbie
  • Start date Start date
D

debbie

I am trying to get a sum of a group of values in the
detail section to print in the page header. I have tried
to set a control in the detail section to =sum
(fieldvalue), but I cannot zero it between groups, and
setting the running sum property to Over Group does not
work - it still sums ALL the detail records. I have tried
adding the values to a field in the detail section, and
then setting the field in the page header to that value at
pageHeader_Print - but that gives a blank first header,
and a second header with the sum of first group. I would
appreciate any ideas...
 
Placing a total in the page header could be unreliable, due to the timing of
events in Access. You certainly could not rely on picking up the totals from
the group footer.

An alternative might be to use a DSum() expression in the Control Source of
the text box. It's 3rd argument would pick up the value of the current
group, and then sum the total for that group directly from the source table.
That should be reliable unless the report is opened in some way that filters
it so that not all values appear in the report.
 
Reports are generated in order Headers, Details, Footer. So putting a sum
in the ehader would not sum anything since the details section hasn't been
populated. You could try putting the sum in the footer and make it not
visible, then in the pageFooter_Format have it set the value from the sum
box to an unbound box in the header.

Kelvin Lu
 
Back
Top