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!

Print current record in form. (not report) Access 2010

Status
Not open for further replies.

sparkbyte

Technical User
Sep 20, 2002
879
US
Everything seems to work except the form does not print. I have paused all the printer defigned on my workstation and no print jobs go to any of the queus.

Am I missing something??

Code:
Private Sub Print_Click()
On Error GoTo Err_Print_Click
Dim strDefaultPrinter As String
Dim strDepartmentPrinter As String


' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

MsgBox "Your default printer is " & strDefaultPrinter & ".", vbInformation + vbOKOnly, "Set Printer for Form"


'Set Printer to ILD Department Printer
Set Application.Printer = Application.Printers("Dell 2330dn Laser Printer") ' test desktop printer
'Set Application.Printer = Application.Printers("\\Z02RSCNRC02\NRC SEIT01 Dell Laser Printer 5310n") ' SEIT network printer
strDepartmentPrinter = Application.Printer.DeviceName

MsgBox "Your default printer is " & strDepartmentPrinter & ".", vbInformation + vbOKOnly, "Set Printer for Form"

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.PrintOut acSelection
    
    
'Reset Default Printer
Set Application.Printer = Application.Printers(strDefaultPrinter)

    
Exit_Print_Click:
    Exit Sub

Err_Print_Click:
    MsgBox Err.Description
    Resume Exit_Print_Click
    
End Sub

Thanks

John Fuhrman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top