Page Totals Code error

  • Thread starter Thread starter Tara
  • Start date Start date
T

Tara

I followed Allen Browne's instructions for totaling a sum in a page footer,
but I must've done something wrong because it's throwing an error - The
expression On Format you entered as the event property setting produced the
following error: Expected: end of statement.

When I look at the code, the declarations are highlighted as the source of
the problem. Here is the code I have in the report:


Option Explicit Dim curTotal As Currency



Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If PrintCount = 1 Then
curTotal = curTotal + Me.TotalCost

End If

End Sub

Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As
Integer)

Me.PageTotal = curTotal

End Sub

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As
Integer)

curTotal = 0 'Reset the sum to zero on each new page

End Sub
 
Tara said:
I followed Allen Browne's instructions for totaling a sum in a page footer,
but I must've done something wrong because it's throwing an error - The
expression On Format you entered as the event property setting produced the
following error: Expected: end of statement.

When I look at the code, the declarations are highlighted as the source of
the problem. Here is the code I have in the report:


Option Explicit Dim curTotal As Currency


That is two statements. It should be:

Option Explicit
Dim curTotal As Currency
 
Back
Top