Solved Pages count is 0 (1 Viewer)

Kayleigh

Member
Joined
Sep 24, 2020
Messages
709
Hi

I am attempting to set some objects in page footer to only appear on last page in report. So I tried to use methods shown here or here

My issue is that the Pages property always returns 0 so it can't calculate last page in report. I am not sure if this is due to it being opened on a filter. (Which I could resolve by always changing recordsource on load.

Can anyone help me figure this out please.

Thanks for your continuous support:)
Kayleigh
 
Are you already displaying the page numbers on your report? If so, what is the expression you're using?
 
No. I've just been using Me.pages in vba for the logic
 
You should be able to put a text box in the appropriate page footer or report footer and use the "expression builder" to define what you want printed there. Since there is a drop down list of choices, you will be sure to get the right one.
 
You need to have page x of y in the header/foote so that both page and pages are defined in the header/footer. The no-code solution might be to create a subreport that appears only in the Report Footer section.

Just FYI having page x of y greatly decreases the speed of producing the report since Access has to paginate the ENTIRE report in memory BEFORE it can render the first page in order to show the y value for pages.
 
Thank you. I will try that

I'm not concerned about the speed as these reports will only be couple pages at most (or just one page usually).
 
Hi

Best method which worked for me was having textbox 'page n of m' in page footer. Then use following VBA for logic:
Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
If Page = Pages Then
   Me.Image53.Visible = True
Else
   Me.Image53.Visible = False
End If
End Sub

Thanks for all the suggestions
 

Users who are viewing this thread

Top Bottom