Rocky Smolin at Beach Access Software
rockysmolin at bchacc.com
Thu Dec 11 00:04:10 CST 2008
Exactly what's needed. Thanks Stuart. They're on 2003.
Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com
www.bchacc.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Wednesday, December 10, 2008 9:23 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Changing Printer
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
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com