Has anyone created print dialog VBA for Access 2000 or 2003

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for code that will search the Windows printer file and set the
available printers in a combo box. From there, I would set a default printer
in an Application_Keys table for the next session.

I have seen this code in VB.Net, but not VBA.
 
hum..ok...

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)

note that the application.printers is a collection of the printers...so, you
can loop, and fill a list box with this.

However, you BIG PROBLEM here is a2000, which does NOT have a printer
object.....

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

The above has sample code that fills the combo box will the printers...and
works with pre-a2002...

grab the printer switch example...
 
Back
Top