Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Want report header to appear on alternate pages only

Posted on 2012-08-21
20
Medium Priority
?
554 Views
Last Modified: 2012-09-05
Is there a way to get MS-Access to print the report header on alternate pages only, i.e., first page, third page, etc. I am printing in duplex, and do not want the alternate pages (e.g., second, fourth, pages etc.) that are printed in the back have the header.
0
Comment
Question by:geeta_m9
  • 11
  • 5
  • 2
  • +1
20 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38316272
Go into your report's Header section, and add code that goes something like this:

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

If Me.Page / 2 = CInt(Me.Page) Then
    'Odd numbered pages
    Me.PageHeaderSection.Visible = True
Else
    'Even numbered pages
    Me.PageHeaderSection.Visible = False
End If

End Sub
0
 
LVL 58
ID: 38316283
Not the report header no, but the page header yes.  Follow Jim's comment.

Jim.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38316284
<correction, need more coffee>

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

If Me.Page / 2 = CInt(Me.Page) Then
    'Even numbered pages
    Me.PageHeaderSection.Visible = False
Else
    'Odd numbered pages
    Me.PageHeaderSection.Visible = True
End If

End Sub
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:geeta_m9
ID: 38316299
Sorry, I meant to say page header, not report header.
0
 

Author Comment

by:geeta_m9
ID: 38316350
I tried inserting your code, but now the header does not appear at all.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38316355
Copy-paste your code into this question.
0
 

Author Comment

by:geeta_m9
ID: 38316377
Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

If Me.Page / 2 = CInt(Me.Page) Then
    'Odd numbered pages
    Me.PageHeaderSection.Visible = True
Else
    'Even numbered pages
    Me.PageHeaderSection.Visible = False
End If

End Sub
0
 
LVL 58
ID: 38316382
Do:

If Me.Page Mod 2 = 0 Then
    'Even numbered pages
    Me.PageHeader0.Visible = False
Else
    'Odd numbered pages
    Me.PageHeader0.Visible = True
End If

 Note that "PageHeader0" should be the actual name of your page header section.

Jim.
0
 

Author Comment

by:geeta_m9
ID: 38316400
How do I find out what is the name for my page header section?
0
 

Author Comment

by:geeta_m9
ID: 38316409
I looked up the Name under Properties. It is just called PageHeaderSection.
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 38316422
<typo correction>

Private Sub PageHeaderSection_Format(Cancel As Integer, FormatCount As Integer)

If Me.Page / 2 = CInt(Me.Page / 2) Then   ' added the /2 in the CInt() section
    'Odd numbered pages
    Me.PageHeaderSection.Visible = True
Else
    'Even numbered pages
    Me.PageHeaderSection.Visible = False
End If

End Sub
0
 

Author Comment

by:geeta_m9
ID: 38316435
I think it is working because in the Print Preview section, the heading does not come out for the second page. Let me try printing it out.
0
 

Author Comment

by:geeta_m9
ID: 38316586
It looks like it is working, thanks. I just have one concern though. I only manage to test this on one record so far. If I print out multiple records, will they all have the first page with the header and the second page without the header on the reverse side?
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 38316620
BTW, this will only work in Normal (direct to printer) or Preview mode, as code will not fire in the Report view.
0
 

Author Comment

by:geeta_m9
ID: 38316636
That's ok. We just want to print it out.
0
 
LVL 49

Expert Comment

by:Dale Fye
ID: 38316651
Actually, I think you want the header on odd numbered pages, not even, so you might want to try:

If Me.Page Mod 2 = 1 Then

If I print out multiple records, will they all have the first page with the header and the second page without the header on the reverse side?
Maybe.  The way this is designed is to print the page header on every other page.  If you have want to print for multiple records, then you will need to ensure that every "record" starts on an odd page.
0
 

Author Comment

by:geeta_m9
ID: 38316692
Well each report will be exactly two pages long.
0
 

Author Comment

by:geeta_m9
ID: 38320480
This morning I printing out the reports and they all look great, thanks.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38320512
Thanks for the grade.  Good luck with your project.  -Jim
0
 

Author Comment

by:geeta_m9
ID: 38320594
Thanks!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question