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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

assign printer by pressing a button?

Status
Not open for further replies.

flaviooooo

Programmer
Feb 24, 2003
496
FR
Hi,

I know you can assign a specific printer to a report in the page setup. But is it also possible to assign a printer in code?

For example: 1 button on a form prints the report on printer A, another on printer B, and yet another on printer C ?

Thanks
 
You can add a command button for each printer you want to use but you will have to make multiple reports with each one have a printer assigned to each. You can also assign one that uses your fax or email as a printer too.
 
I've found a better solution. Just add this code in the onclick-event:

Dim OldPrinter As String

OldPrinter = ActivePrinter
Debug.Print OldPrinter
ActivePrinter = "PrinterName"
DoCmd.OpenReport "ReportName", acViewNormal
ActivePrinter = OldPrinter
 
If you have access to a copy of the Access 97 Developer's Handbook from SYBEX by Litwin, Getz and Gilbert (or any later version of this book) they have a chapter for printing (Chapter 10 in my version). It has code for selecting which network printer you want a report to print to. This may be more helpful than having to manually type in a printer name.

I have a 145K zip file that has their source for the chapter, but it would be better to have the book to use as a reference. Terry
**************************
* General Disclaimor - Please read *
**************************
Please make sure your post is in the CORRECT forum, has a descriptive title, gives as much detail to the problem as possible, and has examples of expected results. This will enable me and others to help you faster...
 
Terry,

Any chance you could Email me that zip file as I'm stuck on the same problem?

Thanks

Jason

Email: jason.Gunter@Capita.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top