D
Dale
No matter what I have tried, I cannot get this code to work, in fact the
result doesn't even appear in the unbound text box in the footer of the
report. I liked the fact that the code was lightweight. I'm sure I'm
missing something very simple!
Thanks for any help.
In the footer of the report, unbound Text Box properties: name:ctlGrpPages,
visible yes, control source left blank, in the page header: Text Box
properties: name:OwnerGrp, control source: owner, Owner Footer: force new
page after section.
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!OwnerGrp
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
result doesn't even appear in the unbound text box in the footer of the
report. I liked the fact that the code was lightweight. I'm sure I'm
missing something very simple!
Thanks for any help.
In the footer of the report, unbound Text Box properties: name:ctlGrpPages,
visible yes, control source left blank, in the page header: Text Box
properties: name:OwnerGrp, control source: owner, Owner Footer: force new
page after section.
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!OwnerGrp
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