[AccessD] Specific Printer

Paul Hartland paul.hartland at googlemail.com
Thu Feb 5 04:24:40 CST 2009


Andy,

Just cut some sample code from what I use, you will need to know what the
name of the printer is called on the network, but may get you started (this
is VB6, but don't see why it wouldn't work for you):

    Dim prnPrinter As Printer
    Dim strDeviceName As String


    strDeviceName = Printer.DeviceName
    bolFoundPrinter = False
    ' Loop through all printers to find specific one.
    For Each prnPrinter In Printers
        If (prnPrinter.DeviceName = "Network Zebra P110i USB Card Printer")
Then
     ' Set printer as default to print the report.
            cSetPrinter.SetPrinterAsDefault ("Network Zebra P110i USB Card
Printer")
            'Print report here......
            Exit For
        End If
    Next

    ' Reset default printer to the original one.
    For Each prnPrinter In Printers
        If (prnPrinter.DeviceName = strDeviceName) Then
            cSetPrinter.SetPrinterAsDefault (strDeviceName)
            Exit For
        End If
    Next

Had to negotiate the roads, I need to go freelance lol...

2009/2/5 Andy Lacey <andy at minstersystems.co.uk>

> Hi folks
> How do I supply an MDB with a report set to print to a specific printer
> which I don't have? The report is used by several people in an office and
> needs to print on their one colour printer which is not the default for any
> of them. So it's a network printer and I'm not on their netowrk of course.
> Can this be done, by code if necessary?
>
> Oh and this is A2K.
>
> Cheers
>
> Andy Lacey
>
> PS Deep snow today here. A very pretty English scene as long as you don't
> have to try to negotiate the roads, which I don't tee hee.
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



-- 
Paul Hartland
paul.hartland at googlemail.com



More information about the AccessD mailing list