

In Design view, click the command button, and then click Properties on the View menu.

In the Visual Basic Editor, type the following procedures: Private Sub cmdLaser_Click ()Ĭall ChangePrinter("rptMyReport", "rptLaserPrinter")Ĭall ChangePrinter("rptMyReport", "rptDotMatrix")Įxit the Visual Basic Editor, and then change the On Click property of both command buttons to.
Print selection macro access code#
In Access 2007 and later, click View Code in the Tools group on the Design tab. Save the module as Module1, and then exit the Visual Basic Editor.Ĭreate the following form: Form: frmForm1 Do you want to use the default printer on ? This document was previously formatted for the printer on but that printer isn't available. You will receive the following error message: If you don't use this option, and you save the PrtDevName of a non-default printer to the report design, the report will not be able to find the printer when it runs the next time.

The acSaveNo property is used in the DoCmd.Close acReport, rptPrinter, acSaveNo line of the code. You can then copy the print options that you set for the rptLaserPrinter and rptDotMatrix reports to a specific report that you want to print. The ChangePrinter function copies the PrtDevNames property from one report to another.
