Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rating: Thread Rating: 13 votes, 5.00 average. Display Modes
Old 02-24-2003, 11:42 AM   #1
Dona
Registered User
 
Join Date: Jun 2002
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Dona
Question Page Numbering in a Report

I need help.

I used the code below. It works; however, if one group report has only one page. It currently says page 1 of (blank) when I use the code below. I want it to say page 1 of 1.
WayneRyan answered my Report post. He suggested adding the following line:

Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " & Nz (GrpArrayPages(Me.Page),1)

It didn't work so I changed the text a little
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " &(GrpArrayPages(Me.Page), + 1

This solved the page 1 of 1 problem; however, a new problem was created.
It doesn't quite work.

Group A has one page that now says Page 1 of 1.

Group 2 has 2 pages that now says Page 1 of 2.
The second page of Group 2 also says page 1 of 2.

Group 3 has 3 pages that now says Page 1 of 2.
The second page of Group 3 says Page 1 of 2.
The third page of Group 3 also says Page 1 of 2.

Group 3 would say Page 1 of 2,
The second page of Group 3 says Page 1 of 2.
The third page of Group 3 also says Page 1 of 2.Page 1 of 2

Please help. Thank you.

Original Code:

Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer

Private Sub PageFooter_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!D_NAME
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.Pages) = GrpPage
End If
Else
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

End Sub

Private Sub Report_Open(Cancel As Integer)

End Sub

Dona is offline   Reply With Quote
Old 02-24-2003, 12:00 PM   #2
Rich
Guest
 
Posts: n/a
Do you have a hidden text box in the footer with
="Page " & [Page] & " of " & [Pages] too?
  Reply With Quote
Old 02-24-2003, 12:04 PM   #3
Dona
Registered User
 
Join Date: Jun 2002
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Dona
Yes
Text box says

"Page " & [Page] & " of " & [Pages]

Dona is offline   Reply With Quote
Old 02-24-2003, 12:06 PM   #4
Rich
Guest
 
Posts: n/a
Which footer?, 'should be in the Page footer
  Reply With Quote
Old 02-24-2003, 12:12 PM   #5
Dona
Registered User
 
Join Date: Jun 2002
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Dona
Yes. It is in the Page Footer.
Dona is offline   Reply With Quote
Old 02-24-2003, 01:35 PM   #6
Dona
Registered User
 
Join Date: Jun 2002
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Dona
Rich
Here is a sample.
Attached Files
File Type: zip sample.zip (17.6 KB, 1548 views)
Dona is offline   Reply With Quote
Old 02-24-2003, 02:37 PM   #7
Rich
Guest
 
Posts: n/a
And here's the corrected sample


Last edited by Rich; 08-21-2008 at 09:45 AM.
  Reply With Quote
Old 02-24-2003, 03:13 PM   #8
Dona
Registered User
 
Join Date: Jun 2002
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Dona
Rich

THANK YOU! THANK YOU!

IT WORKS!

Dona

Dona is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump




All times are GMT -8. The time now is 08:11 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World