renumbering page on group breaks

S

SuzyQ

I'm trying to renumber pages on groups breaks. I found code at
http://www.mvps.org/access/reports/rpt0013.htm which was very helpful, but
I'm still having some problems because I also have a parent footer
surrounding the group with page numbers. This code that I found causes the
last group to count the parent's footer as another page within that group. I
want the surrounding footer to have it's own page number as well. The code
below is a combination of what I found and what I did to try to help the
situation. My additional code works in the preview window, but when the
report is printed, the upper level footer page numbers are printed on the
group pages. See code below. I'm sure it's just a matter of changing part
of my code to the on print event from on format event, but I don't know which
part. Can someone help? Thanks

Option Compare Database
Option Explicit

Dim GrpArrayPage(), GrpArrayPages()
Dim GrpNameCurrent As Variant, GrpNamePrevious As Variant
Dim GrpPage As Integer, GrpPages As Integer
Dim atPPEndFooter As Boolean 'ADDED THIS
Dim printPPEndFooter As Boolean 'ADDED THIS

'ADDED THIS SUB TO PARENT'S FOOTER
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
Me.txtTotalLabor = dblTotHours
dblTotHours = 0
If atPPEndFooter = True Then 'second time through
printPPEndFooter = True
End If
atPPEndFooter = True
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!Employee
If GrpNameCurrent = GrpNamePrevious And Not atPPEndFooter 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
If printPPEndFooter = True Then "ADDED THIS IF TO CHANGE TOTAL PAGE
(PARENT'S FOOTER)
Me.txtPageNumber = "Totals Page 1 of 1" 'WILL ALWAYS BE ONLY ONE PAGE
Else
Me.txtPageNumber = Me.Employee & ": Page " & GrpArrayPage(Me.Page) &
" of " & GrpArrayPages(Me.Page)
End If
End If
GrpNamePrevious = GrpNameCurrent
End Sub
 
S

SuzyQ

If someone has the answer, please respond, but in the meantime I've removed
the parent header/footer from this report and put it in a separate summary
report to solve the issue. This is not ideal, but it works for now.
 

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