Find out if report goes to a specific printer (re-post)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

(I am reposting as my previous thread on this subject, started 18 November,
seems to have gone dead for a few days)

I have defined a number of reports that need to be printed on specific
printers (because they have particular stationery loaded). What I need to do
now is check that the user has that printer installed on their machine.

I have noticed that when I hover my mouse over a report name (Access 2002),
I get a tooltip telling me where this report will print. Is there any way I
can programatically retrieve this information? (Having got this, I can loop
through the Printers collection to see if it's installed or not).

From my previous posting of this question I have been down the PrtDevMode
route, and for various reasons I don't think this is going to do the trick
for me. I am willing to be proved wrong on this front, but please read the
earlier thread to see what I've already tried and what my outstanding
reservations are.

Any help will be greatly appreciated.

Jon.
 
Once you open the report, you can read:
Reports("Report1").Printer.DeviceName
Works in design view too.

In Access 2002 and 2003, you can set the Printer before opening the report.
It is therefore feasible to let the user assign a printer to use with each
of their reports, and have the database assign that printer before opening
the report. For a downloadable example, see:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html
 
Allen,

Sorry, this does not do what I need. If I open a report that has a specific
printer assigned, and that printer is not installed on this computer, a
dialog box pops up saying that "This document was previously formatted for
the printer XXX, but that printer isn't available. Do you want to use the
default printer YYY?"

If the I click OK and then examine Reports("Report1").Printer.DeviceName I
get back my default printer, not the printer I wanted to send the report to
originally.

Similarly, letting the user select a printer is not an option. I want to
define the printer myself and make sure the user has this printer installed
before I run the report. Just for info, so you are aware of why I am trying
to do this:

We use a PDF printer called "eDocPrinter PDF Pro". This driver allows us to
set up a number of different named printers, each with a different
configuration (standard PDF, append to an existing PDF, create PDF with a
watermark) and control the precise location and name of the resulting PDF
files. By use of registry settings, we can lock down these configurations so
that the users can't mess them up. If I design a report to use one of these
specific named PDF configurations, I want to check that the user has this
config installed on their machine before I try and open the report. I do have
a slightly clunky solution to this problem, but it involves sending a dummy
report to the printer first and then seeing if the expected PDF file is
created. However, if the relevant config is not installed then I get the
dialog box coming up, which I would prefer the user not to have to deal with.

It's really frustrating that this config name comes up on the tooltip when
you hover over the report name, even if the config is not installed. I just
want to get this back programatically.

Thanks anyway for your suggestion - any other ideas?

Jon.
 
If you know the device name, could you not create a little function with
error handling, and refer to:
Application.Printers("eDocPrinter PDF Pro")
 
Thanks!!

Of course I can. I'm not sure why I didn't think of that. Possibly because I
had come at the problem from a different angle (find out first if the report
is set for a specific printer and then check if that printer is available).
This solution will sort out my immediate issue, as I know in advance what
printer I want to print to.

I don't need any more input on this thread, but ...

As an academic exercise though, I would still like to potentially
future-proof my app and provide a more generic function that I can call to
print any report, and have the function check first whether the report's
printer is available. This could then also be used in other instances, for
example where a report is going to a specific physical printer (because it
has particular stationery loaded), and that printer is replaced with a
different one. I would not need to hunt through my code for any places where
I am checking for this specific printer. Instead I could just set the report
to go to the new printer and the existing code would handle it automatically.

I suppose it's just bugging me that a small piece of information that is
obviously there (IT APPEARS IN THE TOOLTIP!!) is not easily accessible
through code.

Regards,

Jon.
 
It has to be one of the Properties of the report, but the report would have
to be open (a member of the Reports collection) in order to read the
property (unless you can get at it through the Containers!Reports
collection.)

PrtMip/PrtDevNames/PrtDevMode would also give you that Info.
 
Back
Top