Re: Switching Printers using form

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Albert D. Kallal (PleaseNOOOsPAMMkallal_at_msn.com)
Date: 05/08/04


Date: Fri, 7 May 2004 18:01:15 -0600

I have a sample application on how to do this.

Note that access XP does have built in the ability to switch printers. So,
while my code *should* work, you do NOT need it in a2002.

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 defualt printer.
strDefaultPrinter = Application.Printer.DeviceName

' swtich 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 version then access 2002, then the above will not
work...

you can grab my sample change code at:

http://www.attcanada.net/~kallal.msn/msaccess/msaccess.html

--
Albert D. Kallal        (MVP)
Edmonton, Alberta Canada
pleasenonoSpamKallal@msn.com
http://www.attcanada.net/~kallal.msn


Relevant Pages

  • Re: ACC2002: PDFWriter not working like Access2000 w/Win2000
    ... I notice you don't send a command to windows to "refresh" the ... Set Application.Printer = Application.Printers("HP LaserJet Series II") ... dim strDefaultPrinter as string ... Swtich back. ...
    (microsoft.public.access.modulesdaovba)
  • Re: RunReportAsPDF
    ... You don't mention what version\ of ms-access. ... Set Application.Printer = Application.Printers("HP LaserJet Series II") ... dim strDefaultPrinter as string ... that should eliminate a mess of code to switch printers.... ...
    (microsoft.public.access.formscoding)
  • Re: Setting default printer programmatically
    ... Hum, I used the follwing: ... Set Application.Printer = Application.Printers("HP LaserJet Series II") ... dim strDefaultPrinter as string ... Note how I just used string to capture the current printer name...and you ...
    (microsoft.public.access.modulesdaovba)
  • Re: Setting default printer programmatically
    ... LaserJet Series II") ... >dim strDefaultPrinter as string ... >Note how I just used string to capture the current ... >Edmonton, Alberta Canada ...
    (microsoft.public.access.modulesdaovba)
  • Re: Changing DefaultPrinter in Access 97
    ... dim strDefaultPrinter as string ... ' get current defualt printer. ... 'Swtich back. ...
    (microsoft.public.access.modulesdaovba)