In MS Access reports, page counts can be displayed using a text box with the following:
= "Page " & Page & " of " & Pages & " Pages"
However, t开发者_StackOverflow社区his is problematic for large reports, as Access cannot open the first page of the report in Preview until ALL pages have been formatted (so it knows the total number of pages).
Ideally, in Preview I'd only display "Page 123", but when the report is actually Printed, that would get replaced by "Page 123 of 456 Pages".
This is probably wishful thinking, but has anyone managed something like this?
Access 2007 (You didn't indicate your version), has CurrentView property available through vba and you can change the control source of the page text box:
Private Sub Report_Open(Cancel As Integer)
Select Case Me.CurrentView
Case acCurViewDesign
Case acCurViewPreview
' Page # Only
Pages_TextBox.ControlSource = "Page" & Me.Page
Case acCurViewReportBrowse
' Page # of #
Pages_TextBox.ControlSource = "Page" & Me.Page & " of " & Me.Pages
Case acCurViewLayout
End Select
End Sub
精彩评论