Hi!
The code below set the printer correctly (\\wxp-021\hp1210Shipping), but the application print the report on the other printer (\\wxp-018\NetPrintQueue2Fax). Just before the OpenReport command, I put a MsgBox, and the Application.Printer is really \\wxp-021\hp1210Shipping, but it print on the \\wxp-018\NetPrintQueue2Fax
For i = 0 To Application.Printers.Count - 1
If sDest = "Shipping" Then
If Application.Printers.Item(i).DeviceName = "\\wxp-021\hp1210Shipping" Then
Set Application.Printer = Application.Printers(i)
Exit For
End If
Else
If Application.Printers.Item(i).DeviceName = "\\wxp-018\NetPrintQueue2Fax" Then
Set Application.Printer = Application.Printers(i)
Exit For
End If
End If
Next i
If bLang Then
DoCmd.OpenReport "Fax_Anglais", acViewNormal
Else
MsgBox Application.Printer.DeviceName 'Result: \\wxp-021\hp1210Shipping
DoCmd.OpenReport "Fax_Francais", acViewNormal 'Result: Print on the \\wxp-018\NetPrintQueue2Fax
End If
The code below set the printer correctly (\\wxp-021\hp1210Shipping), but the application print the report on the other printer (\\wxp-018\NetPrintQueue2Fax). Just before the OpenReport command, I put a MsgBox, and the Application.Printer is really \\wxp-021\hp1210Shipping, but it print on the \\wxp-018\NetPrintQueue2Fax

For i = 0 To Application.Printers.Count - 1
If sDest = "Shipping" Then
If Application.Printers.Item(i).DeviceName = "\\wxp-021\hp1210Shipping" Then
Set Application.Printer = Application.Printers(i)
Exit For
End If
Else
If Application.Printers.Item(i).DeviceName = "\\wxp-018\NetPrintQueue2Fax" Then
Set Application.Printer = Application.Printers(i)
Exit For
End If
End If
Next i
If bLang Then
DoCmd.OpenReport "Fax_Anglais", acViewNormal
Else
MsgBox Application.Printer.DeviceName 'Result: \\wxp-021\hp1210Shipping
DoCmd.OpenReport "Fax_Francais", acViewNormal 'Result: Print on the \\wxp-018\NetPrintQueue2Fax
End If