Skip to Content
Access Cookbook
book

Access Cookbook

by Andy Baron, Ken Getz, Paul Litwin
February 2002
Intermediate to advanced
720 pages
21h 37m
English
O'Reilly Media, Inc.
Content preview from Access Cookbook

Print Different Headers or Footers on Odd and Even Pages

Problem

Some of your reports are printed double-sided, and you would like to have mirror-image headers and footers on odd and even pages. How do you do this in Access?

Solution

This technique makes use of two sets of header and footer controls, one for odd pages and one for even pages. An event procedure run from the section’s Format event uses the Page property and the Mod operator to determine whether the page is odd or even and makes the appropriate controls visible or invisible.

The following steps show you how to create your own report that prints different headers and footers on odd and even pages:

  1. Open the report you want to print double-sided (or even single-sided, with different odd and even headers and footers).

  2. Make a copy of the header control, and place one of the copies of the control on the left of the header and the other on the right. Make the lefthand control left-aligned (to print on even-numbered pages) and the righthand control right-aligned (to print on odd-numbered pages).

  3. Create an event procedure attached to the OnFormat property of the report’s page header section. In the event procedure, enter code similar to the following:

    Private Sub PageHeader_Format(Cancel As Integer, FormatCount As Integer)
        On Error GoTo PageHeader_FormatError
        
        Dim fIsEven As Boolean
        
        fIsEven = acbIsEven(Me.Page)
        
        Me![lblTitleLeft].Visible = Not fIsEven
        Me![lblTitleRight].Visible = fIsEven
        
    End Sub

    You’ll need to replace the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Access Cookbook, 2nd Edition

Access Cookbook, 2nd Edition

Ken Getz, Paul Litwin, Andy Baron
Access Data Analysis Cookbook

Access Data Analysis Cookbook

Ken Bluttman, Wayne S. Freeze
ADO.NET Cookbook

ADO.NET Cookbook

Bill Hamilton
Access Hacks

Access Hacks

Ken Bluttman

Publisher Resources

ISBN: 0596000847Catalog PageErrata