Print multiple reports from first printer

A

Alex

I am trying to write VBA on a form button on_click event that will open
report1 and allow the user to choose which printer he/she would like to use.
I would then like report1, report2, report3 and report4 to all print to that
printer, without the user having to keep picking the printer. I've tried for
hours and can't get this to work. Any suggestions are appreciated. Thank
you.
 
A

Allen Browne

If this is Access 2002 or later, you can set a printer like this:
Set Printer = Printers(1)

Access will then use that printer until you reset it to the Windows default
with:
Set Printer = Nothing

This assumes you have not set up the report to go to a particular printer
(using the Page Setup dialog in report design view), but that it is set to
go to the default.

You probably want to use the DeviceName of the printer rather than its
number. You can get its name in the Immediate Window with:
? Printers(1).DeviceName
and then use the name like this:
Set Printer = Printers("xxx")

For an example of how to create a combo box loaded with the user's current
printers, see:
http://allenbrowne.com/AppPrintMgt.html
That utility goes further than you want (assigning a custom property to a
report so it remembers which printer to use for that report), but it may be
worth downloading the sample to see how to load the combo and work with the
Printers collection.

For Access 2000 or earlier, this technique will not work. The page contains
links for A97 and A2000 databases to samples created by Albert Kallal
(Access MVP.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top