Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New page number on break

Status
Not open for further replies.

Aietoe

Technical User
Nov 30, 2000
85
CA
I,

Using Acces97 i'm trying to reset the page number to 1 on a group break.

Here is my code:

Private Sub PageFooter_Format(Cancel As Integer, FormatCount As Integer)
Dim i As Integer
ReDim Preserve GrpArrayPage(Me.Page + 1)
ReDim Preserve GrpArrayPages(Me.Page + 1)
If Me.Pages = 0 Then
GrpNameCurrent = Me!Bénef
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 get Group page 1 of x to x of x for my first group, but my second group generates "Blanks" - «GROUP PAGE OF »

Could someone give me a hint on where is the error..


Thanks

Aietoe!

 
Aietoe,

Check out my last response in this thread: thread703-18458.

It looks like you will have to move your ReDim statements to after the
Code:
If Me.Pages = 0 Then
line....

Hoc nomen meum verum non est.
 
I CosmoKramer,

I copied your exact code from Thread703-18458 as follow:

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!Bénef
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 = "Page " & GrpArrayPage(Me.Page) & " sur " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub


The only thing i changed is the "GrpNameCurrent"

and i'm now back with my first error «Subscript out of range»....

Please, don't let me down.... I really don't know what to do!!!!!

And thanks in advance for your patience!

Aietoe!
 
Sorry, I missed this from your first post:

I've created a text box with the following control source ="Page " & [Page] & " of " & [Pages] in the group footer.

Try moving this text box to the page footer

Let me know if this helps....

Hoc nomen meum verum non est.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top