Andy Lacey
andy at minstersystems.co.uk
Thu Feb 5 04:50:59 CST 2009
Yes I know the printer name so I'll give this a try. Thanks Paul. (Yea I must say it's one of the upsides of being freelance. No boss to say "you didn't make the effort") Andy -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Paul Hartland Sent: 05 February 2009 10:25 To: Access Developers discussion and problem solving Subject: Re: [AccessD] Specific Printer 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com