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

Access 2007 hangs with application.printer setting

Status
Not open for further replies.

mcaraker

IS-IT--Management
Oct 12, 2005
5
US
I have the following code which works great on all but 3 of our computers. On those computers it hangs indefinitely on the "set" command. It doesn't seem to matter what the default printer is that is selected or what user is logged into the PC.

Private Sub Form_Open(Cancel As Integer)
Dim strDefaultPrinter As String
strDefaultPrinter = Application.Printer.DeviceName
Set Application.Printer = Application.Printers(strDefaultPrinter)
Dim stDocName As String
Dim stLinkCriteria As String

stLinkCriteria = "[employee]=" & "'" & Environ("UserName") & "'"
stDocName = "Mainpage"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
End Sub

Any suggestions would be greatly appreciated!
 
Make sure each of those "problem" machines has a local printer defined. It does not need to be attached or even exist, just defined.

(RG for short) aka Allan Bunch MS Access MVP acXP, ac07 - winXP Pro, Win7 Pro
Please respond to this forum so all may benefit
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top