I run the following event in an Access report:
Private Sub GroupFooter1_Print(Cancel As Integer, PrintCount As Integer)
……lngCarCount = lngCarCount + 1
……If Val(txtLightWeightTons) = 0# Then
…………lngZeroLightWeightCount = lngZeroLightWeightCount + 1
……End If
……dblLightWeightGT = dblLightWeightGT + txtLightWeightTons
……dblRecovTonsGT = dblRecovTonsGT + txtPartsTons
……dblScrapTonsGT = dblScrapTonsGT + txtScrapTons
End Sub
From the date range I am using, the report creates seven pages. Interestingly, the above group footer event appears to stop running after page 1 (even though all 7 pages are visible), resulting in incorrect GrandTotals on page 7.
When I set up a watch and step through the group footer events for the first page, it returns to the report when it hits page 2. When I click the arrow to display page 2, and return to the code after that, I can continue watching the event (and vars) and it accumulates correctly. When I continue this method, I can eventually get the correct totals/averages for the report.
Anybody know what causes this behaviour (to stop running this event after page 1) and how I can solve this problem?
Much appreciated!