I need help.
I used the code below. It works; however, if one group report has only one page. It currently says page 1 of (blank) when I use the code below. I want it to say page 1 of 1.
WayneRyan answered my Report post. He suggested adding the following line:
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " & Nz (GrpArrayPages(Me.Page),1)
It didn't work so I changed the text a little
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " &(GrpArrayPages(Me.Page), + 1
This solved the page 1 of 1 problem; however, a new problem was created.
It doesn't quite work.
Group A has one page that now says Page 1 of 1.
Group 2 has 2 pages that now says Page 1 of 2.
The second page of Group 2 also says page 1 of 2.
Group 3 has 3 pages that now says Page 1 of 2.
The second page of Group 3 says Page 1 of 2.
The third page of Group 3 also says Page 1 of 2.
Group 3 would say Page 1 of 2,
The second page of Group 3 says Page 1 of 2.
The third page of Group 3 also says Page 1 of 2.Page 1 of 2
Please help. Thank you.
Original Code:
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!D_NAME
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.Pages) = GrpPage
End If
Else
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
End Sub
Private Sub Report_Open(Cancel As Integer)
End Sub
I used the code below. It works; however, if one group report has only one page. It currently says page 1 of (blank) when I use the code below. I want it to say page 1 of 1.
WayneRyan answered my Report post. He suggested adding the following line:
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " & Nz (GrpArrayPages(Me.Page),1)
It didn't work so I changed the text a little
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " &(GrpArrayPages(Me.Page), + 1
This solved the page 1 of 1 problem; however, a new problem was created.
It doesn't quite work.
Group A has one page that now says Page 1 of 1.
Group 2 has 2 pages that now says Page 1 of 2.
The second page of Group 2 also says page 1 of 2.
Group 3 has 3 pages that now says Page 1 of 2.
The second page of Group 3 says Page 1 of 2.
The third page of Group 3 also says Page 1 of 2.
Group 3 would say Page 1 of 2,
The second page of Group 3 says Page 1 of 2.
The third page of Group 3 also says Page 1 of 2.Page 1 of 2
Please help. Thank you.
Original Code:
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!D_NAME
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.Pages) = GrpPage
End If
Else
Me!ctlgrpPages = " Page " & GrpArrayPage(Me.Page) & " of " & GrpArrayPages(Me.Page)
End If
GrpNamePrevious = GrpNameCurrent
End Sub
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
End Sub
Private Sub Report_Open(Cancel As Integer)
End Sub