I have a report that I'm trying to reset the page numbers at change of group.
Thread [blue]thread703-18458[/blue] has the code that I used. After much struggle, I finally was able to get the page numbers mostly correct.
The problem that I am having is if the details spill over onto page 2 (not a group change), the page 1 of 1 doesn't print.
If I walk through the code the for statement loops through 2 times which results in both grparrayPage(me.page) and grparraypages(me.page) being 2 which prints fine on the 2nd page. Page 1 of 2 is what I can't seem to get to print.
If the group only consists of one page, page 1 of 1 prints fine.
Since the first statement checks for page = 0, I am assuming that on a group change, it automatically goes back to 0. Is this correct?
I have been trying off/on for 2 months now to get this to work properly and am totally out of ideas so any help will be greatly appreciated.
One other thing, the sample said to put the code in page footer but when I did that, nothing printed. When I moved it to the group header section, the page x of x started to print. I have the ctlGrpPages in the group footer along with a text box that says =[pages]
thanks
lhuffst
Thread [blue]thread703-18458[/blue] has the code that I used. After much struggle, I finally was able to get the page numbers mostly correct.
The problem that I am having is if the details spill over onto page 2 (not a group change), the page 1 of 1 doesn't print.
Code:
If Me.Pages = 0 Then
ReDim Preserve GrpArrayPage(Me.page + 1)
ReDim Preserve GrpArrayPages(Me.page + 1)
GrpNameCurrent = Me!txtPermitNo & Me!txtmp1
' Debug.Print Me!txtPermitNo & Left(Me.txtMP, 3)
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
Me!ctlGrpPages = "Page " & GrpArrayPage(Me.page) & " of " & GrpArrayPages(Me.page)
Else
GrpPage = 1
GrpArrayPage(Me.page) = GrpPage
GrpArrayPages(Me.page) = GrpPage
Me!ctlGrpPages = "Page " & GrpArrayPage(Me.page) & " of " & GrpArrayPages(Me.page)
End If
Else
Me!ctlGrpPages = "Page " & GrpArrayPage(Me.page) & " of " & GrpArrayPages(Me.page)
End If
GrpNamePrevious = GrpNameCurrent
If the group only consists of one page, page 1 of 1 prints fine.
Since the first statement checks for page = 0, I am assuming that on a group change, it automatically goes back to 0. Is this correct?
I have been trying off/on for 2 months now to get this to work properly and am totally out of ideas so any help will be greatly appreciated.
One other thing, the sample said to put the code in page footer but when I did that, nothing printed. When I moved it to the group header section, the page x of x started to print. I have the ctlGrpPages in the group footer along with a text box that says =[pages]
thanks
lhuffst