Report page numbers starting on page 2 (1 Viewer)

JulieG

New member
Local time
Today, 01:34
Joined
May 20, 2022
Messages
5
Hello,

I have a main report with several subreports attached. My main report is a cover letter and does not need a number. I want page 1 to start on page 2 Is this possible?

Thanks in advance!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:34
Joined
May 7, 2009
Messages
19,169
use the technique here by adding an Unbound textbox.
make it visible when the Page >= 2.
view the report in Page Preview.
also in actual db, you need to Hide (Visible=False) the "page 1 of xx" textbox.
 

Attachments

  • pageNumber.accdb
    768 KB · Views: 172

JulieG

New member
Local time
Today, 01:34
Joined
May 20, 2022
Messages
5
Thank you very much. I will give it a try.
 

Sodslaw

Registered User.
Local time
Yesterday, 22:34
Joined
Jun 7, 2017
Messages
81
Code:
=[Page]-1 & " of " & [Pages]-1
 

isladogs

MVP / VIP
Local time
Today, 05:34
Joined
Jan 14, 2017
Messages
18,186
Code:
=[Page]-1 & " of " & [Pages]-1
Shouldn't that be +1 in each case?

Another approach is to make the cover letter the main report followed by a page break.
Then insert the 'real report' ... possibly as a subreport
 

Sodslaw

Registered User.
Local time
Yesterday, 22:34
Joined
Jun 7, 2017
Messages
81
@isladogs its based on @arnelgp's solution
if it on page 2, display page 1 (-1) if total Pages =100 display 99 (-1), thats right isnt it... i hope so LOL
 

JulieG

New member
Local time
Today, 01:34
Joined
May 20, 2022
Messages
5
I used =[Page]-1 & " of " & [Pages]-1 and this worked great!! It starts on the second page with 1 of 6 etc. I can't thank you all enough.
 

Seph

Member
Local time
Today, 07:34
Joined
Jul 12, 2022
Messages
73
Is it possible to have page numbers on all pages if the page amount exceeded 1.

So if a single page, then no page number. But if more than 1 then page, then page numbers will appear on every page, including the first.

Code:
Me.PageNumber.Visible = (Me.Page >= 2

This works well, but only pages after page 1 reflect a number/number of pages.

I tried to wrap it in a IIf statement

IIf(Me.Page >= 2), Me.PageNumber.Visible, False)

That didn't seem to worko_O
 

Seph

Member
Local time
Today, 07:34
Joined
Jul 12, 2022
Messages
73
Screenshot 2023-01-27 191128.png


Perhaps I'm ending it off wrong🤔
 

Sodslaw

Registered User.
Local time
Yesterday, 22:34
Joined
Jun 7, 2017
Messages
81
try adding code to the format footer or header event (or wherever you have the page count displayed)

Code:
If Me.Page = 1 Then
    Me.PageNumber.Visible = False
Else
    Me.PageNumber.Visible =True
End If
 
Last edited:

Seph

Member
Local time
Today, 07:34
Joined
Jul 12, 2022
Messages
73
try adding code to the format footer or header event (or wherever you have the page count displayed)

Code:
If Me.Page = 1 Then
    Me.PageNumber.Visible = False
Else
    Me.PageNumber.Visible =True
End If

I like your simple idea. Thank you.

However it's still misbehaving.

I added an unbound field =Page just to ensure that I'm not making a mistake.

The results are still the same

Screenshot 2023-01-27 192410.png
Screenshot 2023-01-27 192405.png
 

Sodslaw

Registered User.
Local time
Yesterday, 22:34
Joined
Jun 7, 2017
Messages
81
i think you have miss read the original post. this is to hide the page text ie "Page 1 of 2" in the footer, not a complete page from a report.
Start a new thread please.
 
Last edited:

Seph

Member
Local time
Today, 07:34
Joined
Jul 12, 2022
Messages
73
are your margins correct? i think you have miss read the original post. this is to hide the page text ie "Page 1 of 2" in the footer, not a complete page from a report.
Start a new thread please.
Margins are right. If I remove the Page Footer Format event then it works fine. Just looks silly with 1 page saying "Page 1 of 1"

My apologies. I will do so.
 

Sodslaw

Registered User.
Local time
Yesterday, 22:34
Joined
Jun 7, 2017
Messages
81
Margins are right. If I remove the Page Footer Format event then it works fine. Just looks silly with 1 page saying "Page 1 of 1"

My apologies. I will do so.
then use this in the report
Code:
=[Page]-1

page 1 there will be no Page x of xx and on 2nd page will display "Page 1"
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:34
Joined
Feb 28, 2001
Messages
27,001
I noted something else that was apparently done incorrectly.

You wanted to know if this was going to be a one-page wonder. The test was supposed to be IF Me.Pages > 1 .... but in the code you showed that addressed the issue, you showed IF Me.Page > 1 .... and that is a different thing. For reports, Me.Page is the current page number but Me.Pages is the number of pages in the report as a whole. They CAN be different.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:34
Joined
May 7, 2009
Messages
19,169
this will only work on Print Preview view of the report.
Open the SampleReport on the demo.
you will see that it has no page number.
close the report and add more records to table1.
open the report again.
 

Attachments

  • hidPageNumIfOnePage.accdb
    544 KB · Views: 55

Seph

Member
Local time
Today, 07:34
Joined
Jul 12, 2022
Messages
73
I noted something else that was apparently done incorrectly.

You wanted to know if this was going to be a one-page wonder. The test was supposed to be IF Me.Pages > 1 .... but in the code you showed that addressed the issue, you showed IF Me.Page > 1 .... and that is a different thing. For reports, Me.Page is the current page number but Me.Pages is the number of pages in the report as a whole. They CAN be different.
Thanks very much for everyone's input.

The below code was the solution I implemented:

Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
      
    Me.PageNumber.Visible = (Me.Pages >= 2)
    
End Sub

Thank you @The_Doc_Man for the Me.Pages solution.
 

Users who are viewing this thread

Top Bottom