Access 2000.
I want to number my pages per group. Like for each site to say 1 of 3 pages instead of the whole report showing 1 of 17 pages.
I have searched all the posts on numberering pages per group.
I got the code but it is not working for me.
My report does the page breaks for the different groups correcly.
I put the code on the PageFooter section.
My control box just comes up blank when I run the report.
Here is the code I am using:
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim I As Integer
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)
GrpNameCurrent = Me.Site
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
'MsgBox GrpArrayPages(Me.Page)
Me.ctlGrpPages = "Test1"
End If
Else
'Me.ctlGrpPages = "TEST2"
'Me.ctlGrpPages = Me.Site & " " & "Page" & " " & GrpArrayPage(Me.Page) & " of " & " " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
It only gets to Test1 even where I expect a page 2 (Test2). Anyone see my problem?
TIA for your suggestions.
I want to number my pages per group. Like for each site to say 1 of 3 pages instead of the whole report showing 1 of 17 pages.
I have searched all the posts on numberering pages per group.
I got the code but it is not working for me.
My report does the page breaks for the different groups correcly.
I put the code on the PageFooter section.
My control box just comes up blank when I run the report.
Here is the code I am using:
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim I As Integer
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)
GrpNameCurrent = Me.Site
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
'MsgBox GrpArrayPages(Me.Page)
Me.ctlGrpPages = "Test1"
End If
Else
'Me.ctlGrpPages = "TEST2"
'Me.ctlGrpPages = Me.Site & " " & "Page" & " " & GrpArrayPage(Me.Page) & " of " & " " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
It only gets to Test1 even where I expect a page 2 (Test2). Anyone see my problem?
TIA for your suggestions.