[AccessD] How to Reset Total Pages Number on Report

Susan Zeller szeller at cce.umn.edu
Thu Feb 20 10:24:00 CST 2003


Billy,  Here's notes I wrote up for this.  Got this info from someone on
this list, pretty sure it was Arthur.  Written very elemetary b/c I
wrote them for other junior developers in my office, but you get the
point.

--Susan

1.  Put an invisible text box in the page footer. Set the control source
to =Pages.

2.  Put a text box on your report in the page footer where you want the
page numbers to go.  Bring up the properties for the text box and in the
area for NAME type in ctlGrpPages

3.  From the VIEW menu, choose CODE.

4.  Copy and paste the following code into the window that appears:

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!Put_In_The_Name_of_the_field_you_are_grouping_on
    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

5.  You'll notice that a line will appear between the third and fourth
lines of the code.  Tha'ts fine.  

6.  In the space where it says
Put_In_The_Name_of_the_field_you_are_grouping_on, type in the name of
the field that you are grouping on.  For example, if you are grouping by
acad_prog, that line should read:

                      GrpNameCurrent = Me!Acad_Prog

7.  Choose FILE/SAVE and then FILE/Close and return to Microsoft Access

-----Original Message-----
From: Billy Pang [mailto:tuxedo_man at hotmail.com] 
Sent: Wednesday, February 19, 2003 7:34 PM
To: AccessD at databaseadvisors.com
Subject: [AccessD] How to Reset Total Pages Number on Report


Hello:

I have a report that displays invoice details by client.
For each invoice there may be multiple pages.
How do I make it so that it diplays X of Y pages for each client?

For example, if there are a total of 3 pages in my report where the
first 
page belongs to Client A and the next two pages belong to Client B, then
I 
want the following page numbers on the bottom of Access report:

Page 1 of 1
Page 1 of 2
Page 2 of 2

I have gotten as far as resetting the page property back to 1 using the 
OnFormat event on my first grouping but I cannot seem to do anything
with 
the [PAGES] property (it is read-only).

Thanks in advance,
Billy




_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list