I have altered the NewPageAfter for a group footer when it is the last group for the report because I want the report totals to print on the same page as the last group total.
The code I'm using is:
Private Sub ftrOperUnit_Format(Cancel As Integer, FormatCount As Integer)
' Sets the ForceNewPage to "After" for the Operating Unit footer only if it is not the last page. (Do not want the report totals to print on a new page.)
If Me.Page = (Me.Pages - 1) Then
Me.ftrOperUnit.ForceNewPage = 0 'New page: None
Else
Me.ftrOperUnit.ForceNewPage = 2 'New page: After
End If
End Sub
-------
The problem that I am having is how this affects the page count in the page footer.
My formula is ="Page " & [Page] & " of " & [Pages].
When the report is actually 9 pages (because the report total is on the same page as the last footer instead of its own page), the formula shows "Page 9 of 10". I want it to say "Page 9 of 9".
I have tried changing the formula to ="Page " & [Page] & " of " & ([Pages]-1).
This works most of the time, unless the Report Totals can't fit on the same page because of space limitations. Then the report totals are rolled over to a new page. So, in that case the formula will show "Page 10 of 9".
Any suggestions to make my Page numbers correct???????????
The code I'm using is:
Private Sub ftrOperUnit_Format(Cancel As Integer, FormatCount As Integer)
' Sets the ForceNewPage to "After" for the Operating Unit footer only if it is not the last page. (Do not want the report totals to print on a new page.)
If Me.Page = (Me.Pages - 1) Then
Me.ftrOperUnit.ForceNewPage = 0 'New page: None
Else
Me.ftrOperUnit.ForceNewPage = 2 'New page: After
End If
End Sub
-------
The problem that I am having is how this affects the page count in the page footer.
My formula is ="Page " & [Page] & " of " & [Pages].
When the report is actually 9 pages (because the report total is on the same page as the last footer instead of its own page), the formula shows "Page 9 of 10". I want it to say "Page 9 of 9".
I have tried changing the formula to ="Page " & [Page] & " of " & ([Pages]-1).
This works most of the time, unless the Report Totals can't fit on the same page because of space limitations. Then the report totals are rolled over to a new page. So, in that case the formula will show "Page 10 of 9".
Any suggestions to make my Page numbers correct???????????