Printer object reference

  • Thread starter Thread starter RipperT
  • Start date Start date
R

RipperT

I have code behind a form button that captures the users default printer,
prints the report, then switches back to the default. I've recently learned
that I can use the printer's reference number within the collection to use
in the code, instead of the device name. My question is: what dictates the
printers position in the collection and what is the likelihood that it will
change, or, under what circumstances would it change? Using code from the
Access help files to generate a list of the printers in the collection, I
noticed that the IP printer I want to use over our network is listed first
(HP LaserJet) followed by all the //network/path/etc/ printers. I changed
the HP to ZP, and it still maintained the same position. Can someone
enlighten me on how the collection thing works? I don't want some printer
gnome in there switching my printer position after I code the forms.

Many, many thanx,

Rip
--
 
You cannot rely on the printers being in the same order over time. If the
user uninstalled one, the others could change. If they reinstalled, the
order could be different.

So, by all means rely on it within one procedure, but not between sessions.

If you haven't seen it, there is a utility here:
http://allenbrowne.com/AppPrintMgt.html
that creates a custom property for the report, and assigns the name of the
printer the user wants for that report. Then the code that opens the report
sets that printer when you print the report.
 
Back
Top