A
Anne
Got below code from The Access Web. *** Note: the line Me!Salesperson should
be changed to the control name of the group you wish to track pages for.
Me!ctlGrpPages is the name of a control you should place in the page footer.
You can also change this line to whatever form you wish your page numbers to
take.
I changed the GrpNameCurrent to Me!txtJobNo, which is the name of the
control JobNo, which is a text field.
The text box in the page footer has the name of: Me!ctlGrpPages
Control Source is: =[Page] & " of " & [Pages]
What did I do wrong, because it does not work?
Anne
----------------------------code---------------------------
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!txtJobNo
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
be changed to the control name of the group you wish to track pages for.
Me!ctlGrpPages is the name of a control you should place in the page footer.
You can also change this line to whatever form you wish your page numbers to
take.
I changed the GrpNameCurrent to Me!txtJobNo, which is the name of the
control JobNo, which is a text field.
The text box in the page footer has the name of: Me!ctlGrpPages
Control Source is: =[Page] & " of " & [Pages]
What did I do wrong, because it does not work?
Anne
----------------------------code---------------------------
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!txtJobNo
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