Change default printer

I

Ian

There seems to be an issue in Access printing to a specific printer if the
print dialogue is opened using RunCommand > Print. It appears to miss out
all the non-black parts of the print. The same problem does not happen if I
use PrintOut instead.

Is there a way in Access (or Access VBA) to find the installed printers,
offer them as a list to pick from, change the default printer to the
selected printer, offer the option to print multiple copies then, after
printing, return the default printer to the original setting?

Essentially what I want is to duplicate the operation of the print dialogue
box, but without using the print dialogue box.

Any ideas? I don't even know how to start with this.

Ian
 
I

Ian

Thanks Ken, but I'm afraid I've fallen at the first hurdle.

I pasted your code into a new module and tried to step through it. As there
are several subs in your code, I've tried stating with each one, and each
gives an error as follows:

cmdRestoreDefault_Click - Compile error (Method or data member not found) on
Set Application.Printer = Nothing
Form_Close - calls the sub above which then fails
Form_Load - User-defined type not defined on Dim prt As Printer
lstPrinters_AfterUpdate - Invalid use of Me keyword

I'm obviously missing something fundamental, but I don't know what. You
mentioned this is from a "form's module". Does this differ in some way from
a module as shown in the VB editor?

Ian
 
K

Ken Sheridan

Ian:

cmdRestoreDefault is the name of a button on the form which restores the
windows default printer.

lstPrinters is the name of the list box which lists the installed printers.

The errors on the 'Set Application.Printer = Nothing' and 'Dim prt As
Printer' lines could be due to a broken or missing reference, or it could be
that you are using an early version of Access before the Printer object was
introduced. I think it came in with Access 2002. If you are using a version
before that then it is possible to list the installed printers but the code
to do so is very complex. If you have a copy of the relevant edition of the
Access Developer's Handbook (Ken Getz et all) it does include code for this
and there are files on the accompanying CD which implement it.

If you are using Access 2002 or later and are still having problems I can
send you a file with the form if you mail me at:

kenwsheridan<at>yahoo<dot>co<dot>uk

Ken Sheridan
Stafford, England
 
I

Ian

Thanks, Ken.

We're currently using Access 2000, so it sounds like the project is a
non-starter. Thatn's anyway.

Ian
 

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