Page Totals Code error

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
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top