Application.Printer

D

DS

Deeper in the thick of things here. I have a table with the following.
PrinterID PrinterName
0 Cash Drawer
1 Bar
2 Kitchen
3 Service

I want to set the Printer by PrinterID not the Name.
Set Application.Printer = Application.Printers((Me.TxtName))

Sets the name. How can I set it by the number? (PrinterID)

Any help appreciated!
Thanks
DS
 
D

DS

Allen said:
Did you try:
Printer = Printers(0)
Allen I had this Printer thing working fine at one point, I actually
used Applicaion.Printer = Application.Printers.Item(Me.TxtNum)
and that pulled the number. It's weird, that doesn't work now, neither
does Printer = Printers(0) it just prints to whatever printer the
report was setup with and the sometimes to the default. Does this stay
in memory or something? Is there anywhere I can read about this In
Depth. Any help is appeciated, thanks DS
 
A

Allen Browne

Setting the Printer object should cause that printer to become the default
printer from Microsoft Access (2002 or later) until you do any of these:
- close Access (it doesn't keep the setting for next time);
- assign another Printer.

If you have a report defined for a "Specific Printer" (Set up through File |
Page Setup in report design view), it will use that specific printer,
regardless of the Windows default or the Printer setting in Access.

If you want to revert to using the Windows default printer again instead of
the one you set the Printer object to, just:
Set Printer = Nothing

What I know about using the Printer object is demonstrated in the sample
database you can download from this article:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html
The utility demonstrates how to allow a user to select one of their
printers, and have the report remember to use that as the default whenever
it runs.
 
D

DS

Allen said:
Setting the Printer object should cause that printer to become the default
printer from Microsoft Access (2002 or later) until you do any of these:
- close Access (it doesn't keep the setting for next time);
- assign another Printer.

If you have a report defined for a "Specific Printer" (Set up through File |
Page Setup in report design view), it will use that specific printer,
regardless of the Windows default or the Printer setting in Access.

If you want to revert to using the Windows default printer again instead of
the one you set the Printer object to, just:
Set Printer = Nothing

What I know about using the Printer object is demonstrated in the sample
database you can download from this article:
Printer Selection Utility
at:
http://allenbrowne.com/AppPrintMgt.html
The utility demonstrates how to allow a user to select one of their
printers, and have the report remember to use that as the default whenever
it runs.
Thanks Allen, I'll look at your utility!
DS
 

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

Similar Threads

Is This Good? 13
Loop Problem 5
RECORDSET 2
Code Is Slow 3
Code Is Slow 6
Access change My Default Printer for All the Reports 4
Alternating Printers 2
Access Change My Default Printer 1

Top