By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,083 Members | 2,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,083 IT Pros & Developers. It's quick & easy.

Call printer by name via code

P: n/a
I have multiple reports that use a "specific printer" because the
default printer is tied up doing other chores.
This is a machine shop environment using Dells' running Win2000 and
XP with Access2003 loaded.
The specific printer is a serial 24 pin dot matrix printer designed to
produce wax stencils.
Some of the PC have Com1 open others have Com2 open and others are
using both Com Ports. I will have to purchase Serial to USB adapters
to get the later PC's to accept the printers.
The problem:
I don't want to have 3 or more versions of the program running to
accommodate all the different flavors of printer configuration.

Is there a way to call up the printer, by name, in code, at run time,
so it won't matter what port the printer is using?

Thanks, Rick

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
First of all, if you intend to reach any specific printer on your network,
then you don't need to fuss with com ports, etc., just install as many
different printers as you need for each workstation. If you intend to have
a dedicated dot matrix for each workstation, then yes, you do.

Secondly, when in report design, go to "File -Page Setup"; there is a dialog
to set the default printer or any of the specific printers that a
workstation has been configured for. You should't have to do anything else.
Users can also always use the Windows Print dialog (Ctrl-P) to change any
printer spec.
-Ed

"2D Rick" <rb*******@compuserve.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I have multiple reports that use a "specific printer" because the
default printer is tied up doing other chores.
This is a machine shop environment using Dells' running Win2000 and
XP with Access2003 loaded.
The specific printer is a serial 24 pin dot matrix printer designed to
produce wax stencils.
Some of the PC have Com1 open others have Com2 open and others are
using both Com Ports. I will have to purchase Serial to USB adapters
to get the later PC's to accept the printers.
The problem:
I don't want to have 3 or more versions of the program running to
accommodate all the different flavors of printer configuration.

Is there a way to call up the printer, by name, in code, at run time,
so it won't matter what port the printer is using?

Thanks, Rick

Nov 13 '05 #2

P: n/a
Thanks for your reply Ed.
If you intend to have

a dedicated dot matrix for each workstation, then yes, you do.<

Printers will be local and have a dedicated task.
They will connect via Com1, Com2, or USB depending on which port is
available.
All Printers will be assigned the same name "Epson LQ-1170 ESC/P 2"
which was assigned when using "adding printer" wizard.

Each time I load the MDB on a PC I have to open each report and reset
it to the specific printer/port. If I can change the default printer to
"Epson LQ-1170 ESC/P 2" and print then set default back, I won't have
to go into report setup.
Even better, Can I just send the report to the printer named "Epson
LQ-1170 ESC/P 2" without messing with the default printer.

Any suggestions, Rick

Nov 13 '05 #3

P: n/a
Yes, the best approach (and one that you hint at) is to NOT set a specific
printer for a report.
(This is way to hard to manage, and just changing a printer means you have
to change your reports!!).

So, leave all reports to the default printer.

You can then make some config table, or whatever, and SET THE printer in
code.

Here is how:

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.

Swtich back.

Set Application.Printer = Application.Printers(strDefaultPrinter)
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.