Access change My Default Printer for All the Reports


L

Lamar

I have reports that should print to specific printer. So for those reports
I went into page setup and change it to the specific printer "My Printer".
Problem - Now all the reports in my database have "My Printer" as their
default printer. I do not want this. I only want "My Printer" for reports I
designate as such. For these other reports I want it to print to user's
default printer.

And "My Printer" is not the default printer when I go "Printer and Faxes" on
my computer. At first I did try to use the following code to make the
designated reports print to "My Printer" Do think this is the problem? Any
help is appreciated.

Dim dpfr as Printer
'Set variable to default printer
Set dfpr = Application.Printer
'Set default printer to My Printer
Set Application.Printer = Application.Printers("My Printer")

'Print report
DoCmd.OpenReport stReportName, acNormal
DoCmd.Close acReport, stReportName, acSaveNo

'Set printer back to default printer
Set Application.Printer = dfpr
 
Ad

Advertisements

A

Allen Browne

Answered in m.p.a.reports.

(Please don't post to multiple groups, as it fragments the response you
get.)
 
M

Martin

Lamar

I remember to have suggested this very same code some weeks ago so very
likely it was me… I thought it was going to work, it looks good. I think that
the printer object has nothing to do with the report or the form object, I
mean, the printer object is associated with application object so changing
the printer by means of setup page must be a way of changing the application
printer object. What got me astonished is that the default printer hadn’t
changed. I see it this way: changing the printer property from either report
or form object is a different way for accessing the very same object. It’s
like having two doors that lead you to the same room.

I think that when any of your designated reports first opens, the
application automatically sets “your printer†as the default one. Therefore,
I suggest you to set any printer property to blank and use the code… What was
the problem with the printer code? Didn’t work?

I figured a different version out, although it’s pretty much the same. You
just work with names

Dim strdfpr as String
'Gets default printer name
strdfpr = Application.Printer.DeviceName
'Set default printer to My Printer
Set Application.Printer = Application.Printers("My Printer")

'Print report
DoCmd.OpenReport stReportName, acNormal
DoCmd.Close acReport, stReportName, acSaveNo

'Set printer back to default printer
Set Application.Printer = Application.Printers(“strdfprâ€)

Good luck, regards
 
L

Lamar

Martin

First - your original code worked fine but it is what I am trying to do that
is the problem. I have reports that are always faxed directly from the
computer. So these need to printed to fax printer. So lets call the printer
"Fax Printer". So I am printing/faxing the reports to multiple clients.
Your code changes the printer to "Fax Printer".

The problem is the fax printer has a dialogue box come up for the user hit
OK to send the fax. This is happening outside of the MS Access environment;
so Access keeps printing the reports to be fax before the user can hit OK.
This causes a problem for the fax printer.

So this is why I am trying to go away from using the coding. I just do not
understand why Access is setting "Fax Printer" as the default for all the
reports. It just does not make sense.
 
Ad

Advertisements

B

Barry A&P

Lamar

I dont know wich version of access you are on but on my 2003 if i open the
report in design view, click file>page setup on the page tab there is an
option to "use a specific printer for this report" and a "printer" button
that allows me to select a specific printer..

Check it out

Barry
 

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