K
kiln
For some reason, the oft recommended code at
http://www.mvps.org/access/reports/rpt0013.htm
does not work for me. Adapted code follows:
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 = POID ' this is the grouped on field
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
txtPage = "Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages
(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
The format event is not running 2x as expected, thus the value of
txtPage is never set. Anyone see that is going on here? Any chance that
this code just doesn't work with Access 2002, latest sp? Or doesn't work
with print preview?
http://www.mvps.org/access/reports/rpt0013.htm
does not work for me. Adapted code follows:
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 = POID ' this is the grouped on field
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
txtPage = "Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages
(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
The format event is not running 2x as expected, thus the value of
txtPage is never set. Anyone see that is going on here? Any chance that
this code just doesn't work with Access 2002, latest sp? Or doesn't work
with print preview?