By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

Choose Printer for Report

P: n/a
Hello I have a report that needs to printed by a specific printer
rather than the computers default printer?
Is there a way to dynamically choose a specific printer to print a
report through VBA code?
I know that in the report's page setup you could choose a specific
printer to print from in the page setup but that is not enough for my
needs.
I need to be able to dynamically choose a printer through code.
Is there a way?
Any help will be highly apreciated.
Thanks,
gil

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
What version of Access are you using? AccessXP lets you manipulate
printers from within code. If you have an earlier version, various
MVPs have code on their websites to do it.

Here's one... and it's from Ken Getz, so you know it works...

http://www.mvps.org/access/reports/rpt0009.htm

Nov 13 '05 #2

P: n/a
If you are using Access 2002 or 2003, you can set the Printer object before
opening the report. There's an example of how to have the report remember to
default to one of the user's printers (not just the developer's printers),
in this links:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html

If you are using Access 2000 or 97, Albert Kallal has code to let you do
that. They are linked in the above article.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

<gi*******@gmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hello I have a report that needs to printed by a specific printer
rather than the computers default printer?
Is there a way to dynamically choose a specific printer to print a
report through VBA code?
I know that in the report's page setup you could choose a specific
printer to print from in the page setup but that is not enough for my
needs.
I need to be able to dynamically choose a printer through code.
Is there a way?
Any help will be highly apreciated.
Thanks,
gil

Nov 13 '05 #3

P: n/a
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")
The above means you don't need my code.

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 of ms-access, then you can use my
lightweight printer switch code here and do the same as above.

http://www.members.shaw.ca/AlbertKal.../msaccess.html
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.