I followed Q132017 to sum the totals for each page on my report. It works perfectly in preview. I have 3 I'm summing, so its slightly different. But for some reason when I print the report the totals come out different from what is previewed. Like the variables aren't resetting, even though I put that code in there. Here's the report code, help!
Dim x As Double
Dim x1 As Double
Dim x2 As Double
Option Compare Database
Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
PageSum = RunSum - x
PageSum1 = RunSum1 - x1
PageSum2 = RunSum2 - x2
x = RunSum
x1 = RunSum1
x2 = RunSum2
End Sub
Private Sub Report_NoData(Cancel As Integer)
On Error GoTo exitsub
MsgBox ("There are no records available that match this criteria")
DoCmd.CancelEvent
exitsub:
End Sub
Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)
x = 0
x1 = 0
x2 = 0
End Sub
Dim x As Double
Dim x1 As Double
Dim x2 As Double
Option Compare Database
Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
PageSum = RunSum - x
PageSum1 = RunSum1 - x1
PageSum2 = RunSum2 - x2
x = RunSum
x1 = RunSum1
x2 = RunSum2
End Sub
Private Sub Report_NoData(Cancel As Integer)
On Error GoTo exitsub
MsgBox ("There are no records available that match this criteria")
DoCmd.CancelEvent
exitsub:
End Sub
Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)
x = 0
x1 = 0
x2 = 0
End Sub