Custom page numbering

T

Tara

I need to number the pages of a report based on group. So, group A could
have pages numbered 1, 2, and 3, and group B could have pages numbered
1,2,3,4, and 5, etc. I tried using this code suggested from The Access Web
http://www.mvps.org/access/reports/rpt0013.htm but I keep getting the
following error: The expression on Format you entered as the event property
setting produced the following error: Statement Invalid outside Type block.
I do have another small piece of code in the same event that I use to set the
value of another textbox, but even removing it doesn't fix the issue, so I
don't think that has anything to do with it. Here's the code as I typed it
(minus my extra bit of code)...maybe I mis-typed and am overlooking the issue:

Dim i As Integer
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)
GrpNameCurrent = Me!County
If GrpNameCurrent = GrpNamePrevious Then
GrpArrayPage(Me.Page) = GrpArrayPage(Me.Page - 1) + 1
GrpPages = GrpArrayPage(Me.Page)
For i = Me.Page - ((GrpPages) - 1) To Me.Page
GrpArrayPages(i) = GrpPages
Next i
Else
GrpPage = 1
GrpArrayPage(Me.Page) = GrpPage
GrpArrayPages(Me.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Group Page" & GrpArrayPage(Me.Page) & "of" &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent

Any help is appreciated!
 

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