Selecting Printers

G

Guest

I have a distributed Access 2000 *.mde database that users will print reports to either dot matrix or ink jet printers that are locally attached. Unfortunately some users have OKIData or Epson dot matrix AND/OR HP some model of ink jet. I have read several threads explaining that it is best to use default printers. This much I can do for the ink jet computers. However how can I detect if they have an OKIData or Epson. I've seen code of Albert D. Kallal.

Question:
1) Can I use the GetPrinters() function to search for the existence of OKIData or Epson and then select it?

2) Must I change explicitly the DEFAULT printer (by WriteProfileString()) in order to select it for printing certain reports. And then restoring the original value?

3) Is it best to select a printer (Epson) for a dot matrix report and if a run-time error is detected then select another printer?

Thanks in advance.

Jay
 
S

SA

Jay:

1.) Not sure what you refer to with the GetPrinters function. There's many
ways to enumerate printers using api calls, but you should do that before
you send it to print. See GetProfileSection (old way) or EnumPrinters
(Win32 way) apis.

2.) An alternative would be to have a set up screen where you ask the user
to select their dot matrix printer and their laser printer and store that
selection information and then use that selection to set the default printer
by report at run time. You then would enum printers to make sure that that
printer is still available on the machine before printing.

3.) The default printer can be changed multiple ways based on the OS in use,
but in all cases WriteProfileString does generally work. You may want to
initiate a SendMessage call that the win.ini has changed after calling
WriteProfileString.

4.) Never do something that will cause an error if you can prevent it before
hand by in this case enuming printers.

If you want something that can wrap this all up for you, you might look at
the PrintersClass which is included in our On the Fly Printing class
modules; available on our web.

HTH
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg

Jay Jones said:
I have a distributed Access 2000 *.mde database that users will print
reports to either dot matrix or ink jet printers that are locally attached.
Unfortunately some users have OKIData or Epson dot matrix AND/OR HP some
model of ink jet. I have read several threads explaining that it is best to
use default printers. This much I can do for the ink jet computers.
However how can I detect if they have an OKIData or Epson. I've seen code
of Albert D. Kallal.
Question:
1) Can I use the GetPrinters() function to search for the existence of
OKIData or Epson and then select it?
2) Must I change explicitly the DEFAULT printer (by WriteProfileString())
in order to select it for printing certain reports. And then restoring the
original value?
3) Is it best to select a printer (Epson) for a dot matrix report and if
a run-time error is detected then select another printer?
 

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