I,
Using Acces97 i'm trying to reset the page number to 1 on a group break.
Here is my 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 Detail_Format(Cancel As Integer, FormatCount As Integer)
End Sub
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!Client
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
I have placed a control «ctlGrpPages» in the page footer.
I've created a text box with the following control source ="Page " & [Page] & " of " & [Pages] in the group footer.
I still get an error saying "Subscript out of range" !!? The error seems to be coming from the 3rd to last line of code (is has changed to yellow) that reads:
Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
Hints:
1)The controltip changes to the message :
"GrpArraypage(Me.Page)=<subscript out of range>" when i move it over the words "GrgArrayPage" in the 3rd tl last line of code
2)The control tip shows that the value of (Me.Pages) as "Me.Page=2"
Help me please, i'm getting quite frustrated.
Thanks in advance.
Aietoe
Using Acces97 i'm trying to reset the page number to 1 on a group break.
Here is my 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 Detail_Format(Cancel As Integer, FormatCount As Integer)
End Sub
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!Client
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
I have placed a control «ctlGrpPages» in the page footer.
I've created a text box with the following control source ="Page " & [Page] & " of " & [Pages] in the group footer.
I still get an error saying "Subscript out of range" !!? The error seems to be coming from the 3rd to last line of code (is has changed to yellow) that reads:
Me!ctlGrpPages = "Group Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
Hints:
1)The controltip changes to the message :
"GrpArraypage(Me.Page)=<subscript out of range>" when i move it over the words "GrgArrayPage" in the 3rd tl last line of code
2)The control tip shows that the value of (Me.Pages) as "Me.Page=2"
Help me please, i'm getting quite frustrated.
Thanks in advance.
Aietoe