Print Event - Event Procedures

Print Event — Event Procedures

See Also         Example

To create an event procedure that runs when the Print event occurs, set the OnPrint property to [Event Procedure], and click the Build button .

Syntax

Private Sub sectionname_Print(Cancel As Integer, PrintCount As Integer)

The Print event procedure has the following arguments.

Argument Description
sectionname The name of the report section whose Print event procedure you want to run.
Cancel The setting determines if the printing of the section occurs. Setting the Cancel argument to True (–1) cancels printing of the section.
PrintCount An Integer value that specifies whether the Print event has occurred more than once for a record. For example, if part of a record is printed on one page and the rest is printed on the next page, the Print event occurs twice, and Microsoft Access sets the PrintCount argument to 2.

Remarks

To cancel printing of the section, you should set the Cancel argument to True (–1) or use the CancelEvent method of the DoCmd object. Microsoft Access prints a blank area on the page where the section would have been. You can use the CancelEvent method or the Cancel argument to skip a record in a report and leave a blank area on the page in its place when the report is printed.

Note   You can't use a Print event procedure to set properties for any object.