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

VB Change Default Printer - Access

Status
Not open for further replies.

scamquist58

Technical User
Dec 15, 2022
6
US
I am trying to change the default printer when an Access form loads.
The following code works:

Private Sub Form_Load()
Dim prtDefault As Printer
Set Application.Printer = Application.Printers(7)
Set prtDefault = Application.Printer
End Sub

However, I want to specify the printer name.

DEVICE NAME: \\PP-FP01\Office Cannon iR-ADV C3230i UFR II
DRIVER NAME: winspool
PORT: 192.168.0.25

Any ideas on how to use device name or port or whatever to accomplish this?
Thank you in advance.



When the form closes, it reverts back to the default using:
Private Sub Form_Unload(Cancel As Integer)
'~~>To restore the Printer object, to the Windows default
'~~> Tis destroys the object. MS Access then reconstructs it - from the default Windows printer.
Set Application.Printer = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top