Microsoft KB Archive/209508

= ACC2000: How to Print Odd or Even Pages of a Report =

Article ID: 209508

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q209508



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
This article describes how to print separately the odd and even pages of a report for duplex printing or to print reports with different margins for binder storage.

NOTE: This article explains a technique demonstrated in the sample file, RptSmp00.mdb. For information about how to obtain this sample file, please see the following article in the Microsoft Knowledge Base:

231851 ACC2000: Microsoft Access 2000 Sample Reports Available in Download Center



MORE INFORMATION
The best way to print separately odd and even pages of a report is to set up a form that prompts you for the pages to print (odd or even) and then calls a macro to print the report. The form in the following example has a text box control to hold the value "odd" or "even" and a command button to print the report.

NOTE: When you use the following steps to print even pages, all the odd pages generate blank pages (and vice versa). Whenever you implement this routine, your report generates blank pages between each printed page.  Create a new form called Print Odd Even Pages:  Add an unbound text box to the form and set its Name property to PrintPages. Add a command button to the form and set its Caption property to Print Report. Set the OnClick property of the command button to the following OddEven.Print macro group.   Create a new macro called OddEven.

NOTE: In the following example, an underscore (_) at the end of a line is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this example.      Macro Name      Condition                        Action --     Print                                         OpenReport TestOddEven Forms![Print Odd Even Pages] _ ![PrintPages]="Even" And _ Page Mod 2=1                    CancelEvent

Forms![Print Odd Even Pages] _ ![PrintPages]="Odd" And _ Page Mod 2=0                    CancelEvent

Print Actions --     OpenReport ReportName: Customer Labels View: Print Preview   From each report section that is printing data, call the macro group OddEven.TestOddEven from the Print event procedure.

For example, in the Northwind.mdb sample database report, Customer Labels, the only section that is printing is the detail section. The page header and page footer in this report do not print any values. For the detail section, set the OnPrint property to the following event procedure: OddEven.TestOddEven </li> With the form open, enter Odd or Even in the text box. When you click the Print Report command button, the Customer Labels report opens. Press OK for all countries. The report then runs its Print events, which call the macro group OddEven.TestOddEven to print only the odd or even pages.</li></ol>

Additional query words: every other page left right

Keywords: kbhowto kbusage KB209508

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.