Susan Geller
sgeller at cce.umn.edu
Thu Jul 24 11:07:06 CDT 2003
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: Heenan, Lambert [mailto:Lambert.Heenan at AIG.com]
Sent: Thursday, July 24, 2003 10:27 AM
To: 'Access Developers discussion and problem solving'
Cc: 'bheid at appdevgrp.com'
Subject: RE: [AccessD] Page numbers
http://support.microsoft.com/default.aspx?scid=kb;en-us;306127
The above kBase article addresses just this situation. It may be good
for you.
Lambert
> -----Original Message-----
> From: Bobby Heid [SMTP:bheid at appdevgrp.com]
> Sent: Thursday, July 24, 2003 9:18 AM
> To: 'Access Developers discussion and problem solving'
> Subject: [AccessD] Page numbers
>
> Hi all,
>
> Have a report that ideally prints on one page per contract, but many
> times could spill over to 2 or 3 pages for the contract. The client
> wants me to put page numbers like so:
>
> page 1 of 1
> page 1 of 2 | 2 page report
> page 2 of 2 | here
> page 1 of 1
> page 1 of 1
> page 1 of 2 | 2 page report
> page 2 of 2 | here
>
> etc.
>
> I am not sure on how to go about doing this. Any ideas? I know that
> I can reset the Page variable, but I do not think that I can reset the
> Pages variable.
>
> I am using Access 97 on Win 2k.
>
> Thanks,
> Bobby
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com