Solved Pages count is 0 (1 Viewer)

Kayleigh

Member
Local time
Today, 16:35
Joined
Sep 24, 2020
Messages
706
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:35
Joined
Oct 29, 2018
Messages
21,473
Are you already displaying the page numbers on your report? If so, what is the expression you're using?
 

Kayleigh

Member
Local time
Today, 16:35
Joined
Sep 24, 2020
Messages
706
No. I've just been using Me.pages in vba for the logic
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:35
Joined
Feb 28, 2001
Messages
27,187
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.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:35
Joined
Oct 29, 2018
Messages
21,473
No. I've just been using Me.pages in vba for the logic
VBA may not be good enough. Try adding a hidden textbox for the pages to see if it makes a difference.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:35
Joined
Feb 19, 2002
Messages
43,275
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.
 

Kayleigh

Member
Local time
Today, 16:35
Joined
Sep 24, 2020
Messages
706
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).
 

Kayleigh

Member
Local time
Today, 16:35
Joined
Sep 24, 2020
Messages
706
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