Specific printers and print dialogue?

  • Thread starter Thread starter Mike Langensiepen
  • Start date Start date
M

Mike Langensiepen

Hi All

Is there any way of launching the standard print dialog so I can choose the
output printer - I often want to PDF outputs or direct to a different
printer.

This also applies for another thing I want to do where I want to print
labels on a shared network printer so I need to be able to immediately print
a single label to (for example) \\PC001\Seikolabel

Thanks

Mike
 
You can change the printer in code (a2002-a2003) has a built in printer
object.

(Wayne's link is also a possible..but, it is problem matic since you have to
be able to switch reports into design mode...something you generally want to
avoid.)

As a general rule, I launch the report in view mode, and THEN let the user
print.

So, launch the report, and then go:

On Error Resume Next
DoCmd.SelectObject acReport, Screen.ActiveReport.Name
DoCmd.RunCommand acCmdPrint

The select object command is needed to fix a "focus" bug if you have a form
with a timer function.

In fact, I build a custom menu bar, and use that for all reports.

This also applies for another thing I want to do where I want to print
labels on a shared network printer so I need to be able to immediately
print a single label to (for example) \\PC001\Seikolabel

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. -- print your report...

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)

If you are using a earlier versions (then 2002), they don't have a printer
swtich object, then you can use my lightweight printer switch code here:

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

Also, note that you can "save" what printer to use with a givne reprot, adn
this takes zero code. However, anytme you move hte software, or a printer is
changed/re-installed, then this approach falls down.
 
Thanks Albert,

I was using preview mode - perhaps I'll stick to this as it is more
flexible. I'm on Access 2003.

Cheers and have a great holiday season!

Mike
 

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

Back
Top