Sunday, April 10, 2005

Tip and Code Sample: Switching Printers from within your MS Access Application

Fellow Access develepor, Mark Plumpton, of customdata.co.nz, has kindly provided sample code for easily switching printers on the fly while printing Access reports, with code as simple as this...

SaveDefaultPrinter
DefaultPrinter = "HP Laserjet (A3)"
DoCmd.OpenReport "rptTest", acViewNormal
RestoreDefaultPrinter

Download these demo Access97/2000 databases, which include a class module that performs the function of listing and switching default printers.

The code is also an excellent example of how you can use classes in your MS Access applications.

No comments: