select printer

  • Thread starter Thread starter RipperT
  • Start date Start date
R

RipperT

Hello, all,

Can anyone show me an example of code that would allow me to print to a
specific printer? I use the button wizard to generate a button that will
print the report, and I see in VB help that I can refer to certain printers
by name or by index number, I just don't know how to code it.

Thanx in advance!

Rip
 
You don't mention what version\ of ms-access.

In access 2002 and later, there is a built in printer object, and it lets
you switch the printer with ease.

You can use:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

So, to save/switch, you can use:

dim strDefaultPrinter as string

' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

' switch to printer of your choice:

Set Application.Printer = Application.Printers("HP LaserJet Series II")

do whatever.

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)


If you are using a earlier versions, then you can use my lightweight printer
switch code here:

http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html
 
Back
Top