My Assistant
![]() ![]() |
|
|
Jul 27 2011, 03:57 AM
Post
#1
|
|
|
UtterAccess Member Posts: 40 From: Wiltshire |
Hi all
Access 2010 sp1 I have 1 report that i need to send to a different printer on clients network, and the printer is not the std default printer. Just a couple of questions please... e.g If bob has the printer name as HP Laserjet 3000 and Sue has the same printer installed as HP LJ how will this effect the following... 1, If i specify the printer name in the report page setup settings - does each user on the network have to have the printer configured with exactly the same printer name for it to work. 2, If I add code to change the report on the fly again does each printer need to be named the same? Many thanks Steve |
|
|
|
Jul 27 2011, 04:12 AM
Post
#2
|
|
|
UtterAccess Enthusiast Posts: 86 |
if access doesn't find the printer specified, does it not prompt at first print? after that the selection is saved.
|
|
|
|
Jul 27 2011, 11:06 AM
Post
#3
|
|
|
UtterAccess VIP Posts: 7,585 From: South coast, England |
Hi skg0509
I set up a form where the user can select their local printer and this is saved in a local (Front End) table (tblAdminInt). Rather than use DoCmd.OpenReport the code calls this function to select the local printer. CODE Public Function PrintPrevReports(strDocName As String, Optional strCrit As String)
On Error GoTo err_proc 'Prints selected report 'Checks calibration dates etc entered 'sets Application.Printer to selected default printer, from stored printer in table tblAdminint 'Assumes all reports previewed Dim rst As DAO.Recordset Dim prt As Printer Dim strPrinter As String Set rst = db.OpenRecordset("tblAdminInt") If rst.BOF = True Then GoTo exit_proc rst.MoveFirst strPrinter = Nz(rst!DefaultPrinter, "") If strPrinter = "" Then strMessage = "The default printer has not been set up." & Chr(13) & Chr(13) & _ "Please contact your system administrator." MsgBox strMessage, vbExclamation, strTitle GoTo exit_proc End If For Each prt In Application.Printers If strPrinter = prt.DeviceName Then GoTo SetPrinter Next strMessage = "The assigned default printer is not available." & Chr(13) & Chr(13) & _ "Please contact your system administrator." MsgBox strMessage, vbExclamation, strTitle GoTo exit_proc SetPrinter: If StrComp(strPrinter, prt.DeviceName, vbBinaryCompare) <> 0 Then rst.Edit 'Priner name is case sensitive -update tblAdminInt rst!DefaultPrinter = prt.DeviceName rst.Update strPrinter = prt.DeviceName End If Application.Printer = Application.Printers(strPrinter) Set prt = Application.Printers(strPrinter) ' Open and print the report using the new application-level printer settings. DoCmd.OpenReport strDocName, acPreview, , strCrit Reports(strDocName).Printer = prt ' Reset the application printer as the default. Set Application.Printer = Application.Printers(0) exit_proc: On Error Resume Next rst.Close Exit Function err_proc: MsgBox err.Description, , strTitle Resume exit_proc End Function |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 21st May 2013 - 06:56 AM |