Stuart McLachlan
stuart at lexacorp.com.pg
Wed Dec 10 23:22:50 CST 2008
The Printer object was introduces in either Acess XP or 2003? Private Declare Function GetComputerName Lib "kernel32" _ Alias "GetComputerNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long Function ReturnComputerName() As String Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next sLen = GetComputerName(rString, 255) sLen = InStr(1, rString, Chr(0)) If sLen > 0 Then tString = Left(rString, sLen - 1) Else tString = rString End If On Error GoTo 0 ReturnComputerName = UCase(Trim(tString)) End Function Function PrintToPrinter(ComputerName as string, NewPrinter as String) As Long Dim strPrinter As String If ReturnComputerName = ucase$(ComputerName) Then 'store current system default printer strPrinter = Application.Printer.DeviceName 'set new system default printer Application.Printer = Application.Printers(NewPrinter) end if 'Do all your reports ......... 'Reset back to original Default printer if necessary If strPrinter > "" Then Application.Printer = Application.Printers(strPrinter) End If On 10 Dec 2008 at 20:30, Rocky Smolin at Beach Access wrote: > Dear List: > > Is there a simple way to change the printer on a report? Client wants to > change the printer for about 40-50 reports when run from a specific > computer. He can tell what computer is running the report so > > If Computer = 'xxx' then Default printer = 'yyyy' > > It's OK to hardcode xxxx and yyyy and the printer doesn't have to be > changed back to the original printer after being changed. > > MTIA > > > > > > Rocky Smolin > > Beach Access Software > > 858-259-4334 > > www.e-z-mrp.com <http://www.e-z-mrp.com/> > > www.bchacc.com <http://www.bchacc.com/> > > > > > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com