Step2: Make sure that in your Group Hearder Section under properties that you have Force New Page set to None and On Format is blank.
Step3: Make sure in the Group Footer Section under properties that you have Force New Page set to None and On Format is blank.
Step4: Goto Insert on the Menu bar and select Page Numbers, select Page N of M, select Bottom of Page(assuming you want the page info at the bottom of the page), select Alignment, and Show number on First Page if desired.
Step5: For the box you just created in Step4 select properties and make Visible = No.
Step6: Open your tool box and and click the [ab|] button, create an unbound text box in the Page Footer section of your report.
Step7: Delete only the Label box for the unbound text box you created in Step6. You won't need the Label.
Step8: In properties on the unbound text box you just created type ctlGrpPages in the Name field under the All tab.
Step9: Goto View on the Menu bar and select Code. Once Visual Basic windows opens be sure you select PageFooterSection and Format in the 2 boxes on the right above the large entry box where the code below will be pasted!
Step10: Paste the code below this line into the large entry box:
Option Compare Database
Option Explicit
Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
End Sub
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!yournamehere
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 = "Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
Step11: Make sure that this parameter:
GrpNameCurrent = Me!yournamehere
has your Group Header name in place of Name!
This can be found in the report design view on the gray bar for the section called (yourname Header)!
Step12: Save and close the VB screen.
Step13: View the report. The unbound text box should read Page 1 of ? and as you scroll through the pages you should see with the next changed value for Group Header the page number change to Page 1 of ? for that group!
Hope this is a detailed enough procedure for any novice to be able to complete this function! Good Luck!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.