I have come across the following piece of code that I was hoping would reset the page number and number of pages (displayed in the Page Footer unbound control named ctlGrpPages) on the change of group (txtOrgName) within my report.
My report has 4 Organisations (txtOrgName), producing 8 pages, so I am expecting …
Page 1 of 2 / Page 2 of 2
Page 1 of 1
Page 1 of 3 / Page 2 of 3 / Page 3 of 3
Page 1 of 2 / Page 2 of 2
As I Page Forward the report and step through the code it never seems to execute the step Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Private Sub PageFooterSection_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!txtOrgName
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
End Sub
I have also tried by introducing a GroupFooter format event but to no avail.
Any help would be gratefully received.
Private Sub OrgNameGroupFooter_Format(Cancel As Integer, FormatCount As Integer)
Page = 1
End Sub
My report has 4 Organisations (txtOrgName), producing 8 pages, so I am expecting …
Page 1 of 2 / Page 2 of 2
Page 1 of 1
Page 1 of 3 / Page 2 of 3 / Page 3 of 3
Page 1 of 2 / Page 2 of 2
As I Page Forward the report and step through the code it never seems to execute the step Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Private Sub PageFooterSection_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!txtOrgName
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
End Sub
I have also tried by introducing a GroupFooter format event but to no avail.
Any help would be gratefully received.
Private Sub OrgNameGroupFooter_Format(Cancel As Integer, FormatCount As Integer)
Page = 1
End Sub