Hello Fred
I try to do the same but it not works, what i did till now is:
1: I put the code behind the report
2: Changed the me.salesperson in me.municipio_referido
3: I put and unbound textbox named: ctlGrpPages
4: I put an unbound textbox with control source = [pages]
saved all and run the report
I only see Page 1 of 19 which was the original page counter textbox
The textbox named ctlGrpPages is empty and textbox with controlsource
=[pages] shows 19
Did I forget something to do?
I like to have the working
Herman
** snipped **
Hermie,
You evidently have a control that calculates [Pages] already in your
report (the one that prints "Page 1 of 19 " so you do not need the
second one (= [Pages]). You can delete it.
Why your report is not displaying the group pages I have no idea.
Did you place the unbound control [ctlGrpPages] in the Page Footer
section? (Not in the Group footer nor in the Report Footer.)
Is that control's Visible propert set to YES?
Did you step through the code, on line at a time, to see whether it
was accumulating the pages?
Here is the exact code, copied and pasted from my sample database,
that prints the group page of pages in a control in the PAGE FOOTER.
See how it compares to yours.
Pehaps Copy and Paste this directly into your code window.
(Watch out for improper line wrap on the longer lines.)
The only difference should be in the line
GrpNameCurrent = Me!LastName
It should be changed to
GrpNameCurrent = me!municipio_referido
if municipio_referido is the name of the group being counted.
_____________________________
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!LastName
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
The ctlGrpPages will display "Group Page 1 of 3" , "Group Page 2 of
3", etc.