Page numbering in footers (Page # of #)

E

EA

I have a monthly productivity report that I print for a list of staff members
and the report content is fine. However, some employees have multiple pages
and I have to indicate page numberings at the footer (i.e., Page 1 of 7,
etc...). The problem is that Access will indicate the total number of pages
for all employees, so instead of John Doe's report showing 'Page 1 of 7' it
shows 'Page 1 of 357'.

Does anyone know a way so to have this report display the 'Page 1 of 7'
format?

Thanks in advance!
 
M

Marshall Barton

EA said:
I have a monthly productivity report that I print for a list of staff members
and the report content is fine. However, some employees have multiple pages
and I have to indicate page numberings at the footer (i.e., Page 1 of 7,
etc...). The problem is that Access will indicate the total number of pages
for all employees, so instead of John Doe's report showing 'Page 1 of 7' it
shows 'Page 1 of 357'.

Does anyone know a way so to have this report display the 'Page 1 of 7'
format?

This KB article explains a way to do it:
http://support.microsoft.com/kb/841779/en-us
 
S

Sarah

Doug,

The code on this website doesn't work. Can you tell me what I'm doing
wrong. I have a report that has one grouping by Compnay Name.

The first company is one page which shows 1 of 1. The 2nd company has 2
pages and it shows 1 of 1 on the first page and 2 of 2 on the second page. I
don't know what I'm doing wrong. I've used the same code as below:

Option Compare Database
Option Explicit

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![Company 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.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub

Any ideas?

Thank you,

Sarah
 
D

Douglas J. Steele

Afraid I can't comment on why it's not working for you. I can only say that
I've used that code successfully on many occasions. I don't see any obvious
error.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Sarah said:
Doug,

The code on this website doesn't work. Can you tell me what I'm doing
wrong. I have a report that has one grouping by Compnay Name.

The first company is one page which shows 1 of 1. The 2nd company has 2
pages and it shows 1 of 1 on the first page and 2 of 2 on the second page.
I
don't know what I'm doing wrong. I've used the same code as below:

Option Compare Database
Option Explicit

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![Company 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.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub

Any ideas?

Thank you,

Sarah

Douglas J. Steele said:
 
S

Sarah

Thanks anyway. I figured it out. The only way it would work for me is if I
had a control that used the Pages property. I put that in the Page footer
and hid it which worked. That's not exactly clear in the documentation.
When reading the statement below which is in the documentation, you wouldn't
think you would have to do that.

"Because the code listed uses the Pages Property (Total number of pages),
you automatically force access to format the report twice."

I guess it needed the Pages to do the second pass through.

Douglas J. Steele said:
Afraid I can't comment on why it's not working for you. I can only say that
I've used that code successfully on many occasions. I don't see any obvious
error.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Sarah said:
Doug,

The code on this website doesn't work. Can you tell me what I'm doing
wrong. I have a report that has one grouping by Compnay Name.

The first company is one page which shows 1 of 1. The 2nd company has 2
pages and it shows 1 of 1 on the first page and 2 of 2 on the second page.
I
don't know what I'm doing wrong. I've used the same code as below:

Option Compare Database
Option Explicit

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![Company 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.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub

Any ideas?

Thank you,

Sarah

Douglas J. Steele said:
Check http://www.mvps.org/access/reports/rpt0013.htm at "The Access Web"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have a monthly productivity report that I print for a list of staff
members
and the report content is fine. However, some employees have multiple
pages
and I have to indicate page numberings at the footer (i.e., Page 1 of
7,
etc...). The problem is that Access will indicate the total number of
pages
for all employees, so instead of John Doe's report showing 'Page 1 of
7'
it
shows 'Page 1 of 357'.

Does anyone know a way so to have this report display the 'Page 1 of 7'
format?

Thanks in advance!
 
D

Douglas J. Steele

Thanks for the feedback. I'll pass that on to Arvin, who maintains the site.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Sarah said:
Thanks anyway. I figured it out. The only way it would work for me is if
I
had a control that used the Pages property. I put that in the Page footer
and hid it which worked. That's not exactly clear in the documentation.
When reading the statement below which is in the documentation, you
wouldn't
think you would have to do that.

"Because the code listed uses the Pages Property (Total number of pages),
you automatically force access to format the report twice."

I guess it needed the Pages to do the second pass through.

Douglas J. Steele said:
Afraid I can't comment on why it's not working for you. I can only say
that
I've used that code successfully on many occasions. I don't see any
obvious
error.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Sarah said:
Doug,

The code on this website doesn't work. Can you tell me what I'm doing
wrong. I have a report that has one grouping by Compnay Name.

The first company is one page which shows 1 of 1. The 2nd company has
2
pages and it shows 1 of 1 on the first page and 2 of 2 on the second
page.
I
don't know what I'm doing wrong. I've used the same code as below:

Option Compare Database
Option Explicit

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![Company 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.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub

Any ideas?

Thank you,

Sarah

:

Check http://www.mvps.org/access/reports/rpt0013.htm at "The Access
Web"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have a monthly productivity report that I print for a list of staff
members
and the report content is fine. However, some employees have
multiple
pages
and I have to indicate page numberings at the footer (i.e., Page 1
of
7,
etc...). The problem is that Access will indicate the total number
of
pages
for all employees, so instead of John Doe's report showing 'Page 1
of
7'
it
shows 'Page 1 of 357'.

Does anyone know a way so to have this report display the 'Page 1 of
7'
format?

Thanks in advance!
 
S

Sarah

You're welcome.

Douglas J. Steele said:
Thanks for the feedback. I'll pass that on to Arvin, who maintains the site.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Sarah said:
Thanks anyway. I figured it out. The only way it would work for me is if
I
had a control that used the Pages property. I put that in the Page footer
and hid it which worked. That's not exactly clear in the documentation.
When reading the statement below which is in the documentation, you
wouldn't
think you would have to do that.

"Because the code listed uses the Pages Property (Total number of pages),
you automatically force access to format the report twice."

I guess it needed the Pages to do the second pass through.

Douglas J. Steele said:
Afraid I can't comment on why it's not working for you. I can only say
that
I've used that code successfully on many occasions. I don't see any
obvious
error.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Doug,

The code on this website doesn't work. Can you tell me what I'm doing
wrong. I have a report that has one grouping by Compnay Name.

The first company is one page which shows 1 of 1. The 2nd company has
2
pages and it shows 1 of 1 on the first page and 2 of 2 on the second
page.
I
don't know what I'm doing wrong. I've used the same code as below:

Option Compare Database
Option Explicit

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![Company 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.Page) = GrpPage
End If
Else
Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " &
GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub

Any ideas?

Thank you,

Sarah

:

Check http://www.mvps.org/access/reports/rpt0013.htm at "The Access
Web"

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


I have a monthly productivity report that I print for a list of staff
members
and the report content is fine. However, some employees have
multiple
pages
and I have to indicate page numberings at the footer (i.e., Page 1
of
7,
etc...). The problem is that Access will indicate the total number
of
pages
for all employees, so instead of John Doe's report showing 'Page 1
of
7'
it
shows 'Page 1 of 357'.

Does anyone know a way so to have this report display the 'Page 1 of
7'
format?

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top