Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to specify Printer settings in my macro? 2

Status
Not open for further replies.

khwaja

Technical User
Aug 27, 2001
431
AU
I would like to print my reports using a PDF writer. Is there any way I can indicate the printer choice in my macro I am using to print? Currently, I change my default printer before I run the macro to create PDF files. I print quite a large number of reports for various regions, therefore I needed to automate the process instead of changing the printer type in print dialogue each time.

Cheers
 
Why don't you just set a specific printer for each report object?
 
Could we do that? I wasn't aware of this. Could you pleasse guide me how to do this?

Cheers
 
I may have told you wrong. I thought that one version of Access had a sticky printer feature, but have just checked 97 and XP and neither does. In XP you will almost certainly be able to set the printer through Visual Basic. I'll look again in more detail and get back to yuo. Sorry for the bad advice.
 
No problem By the way I am using MS Access 97.

Cheers
 
There is a way to specify a printer. In design view of the report, go to File=>Page Setup. In the page tab, you can select whether you want the report to print to default printer or a specific printer.

HTH

Will
 
I thought the same as Ymesei, but I've just checked again and it's not so. Access does not provide the permanent choice of a non-defalut printer

But I've remebered having to do this and there is a way, provided you have the Common Dialogues OLE Control. You can put a command button on the form that you use to start the print. In the OnClick event you put a single line of code in the sub:

"Me!ocxChangePrinter.ShowPrinter"

This will bring up the normal printer dialogue box and allow you to choose your PDF interface.

But having said all of this, I still think it might be simpler to remember to change the printer before you start the print job.
 
Thanks. Is there any code/routine I can use which opens the report and thjen print it using a PDF driver?

Cheers
 
Thanks. Is there any code/routine I can use which opens the report and then print it using a PDF driver? This will simplify the whole process. Please note that am after printing a report, not a form, if it matters.

Cheers
 
The feature that I mentioned above works in Access 97. I don't have a copy of 2000 or higher, so I'm not sure if it works for those versions. But I do know that it works. Make sure that you change the Page setup while in design view of the report and save the report. Then it will keep that setting every time you print the report.

One problem is if you are sharing this report across computers, the description of the device must be the same on all the machines. Any machine that doesn't have the same device description will just print to the default printer.
 
Further apologies - You are quite right Ymesei - the printer selection DOES indeed stick, so you could have two versions of the same report, but with different printers selected. You could invoke them using two appropriately captioned command controls.

Once again, my apologies.
 
Much appreciate Ymesei and Milkey69 for sorting this out. This actually solved a mystry as well as I had several reports and some of these would always print using PDF printer and others wouldn't. I must have changed the printer setting for such reports in the design screen. Again thanks a lot.

AK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top