Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This site is truly a marvel. Without a doubt the most comprehensive, friendly and just plain useful resource of its kind..."

Geography

Where in the world do Tek-Tips members come from?

Microsoft: Access Reports FAQ

How To

How do you Print First and Last Page Numbers for Report Groups?
Posted: 9 Aug 02

Step1: Open your report in Design View.

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!

Back to Microsoft: Access Reports FAQ Index
Back to Microsoft: Access Reports Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close