*** H E L P ***** - Printing to specific Printer Driver

  • Thread starter Thread starter Jasmine
  • Start date Start date
J

Jasmine

I want to print a form and its contents ,

In the past i've use Docmd.Printout to send the form to the printer
this has worked well in the past.

Now I want to sent the printout to a specific Printer Driver in
my Printers Drivers Selection.

Preferrably would like to choose which printer driver I want.
One of these drivers are a Print Capture with specific routing capabilities
 
Jasmine said:
I want to print a form and its contents ,

In the past i've use Docmd.Printout to send the form to the printer
this has worked well in the past.

Now I want to sent the printout to a specific Printer Driver in
my Printers Drivers Selection.

Preferrably would like to choose which printer driver I want.
One of these drivers are a Print Capture with specific routing
capabilities

The way I deal with this is:

1. Set the Report to print to the Windows default printer (File | Page Setup
| Page | Default Printer.

2. Provide the user with a listbox from which to choose a printer. This
little function will return a semicolon-delimited list of printers for use
as a listbox's RowSource (RowSourceDataType must be 'Value List')

Public Function PrinterList() As String
Dim pr As Access.Printer
'
For Each pr In Application.Printers
r$ = r$ & ";" & pr.DeviceName
Next
If r$ <> "" Then
PrinterList = Mid$(r$, 2)
End If
End Function

3. Save the current setting of the 'Windows Default Printer', change it to
the printer selected by the user, then run the report, and finally return
the default to the saved string. The code I use for this is:

Public Sub SetDevice(ByVal pDevice As String)
Static SavedPrinter As String
'
With Application
If Len(pDevice) Then
SavedPrinter = .Printer.DeviceName
Set .Printer = .Printers(pDevice)
Else
Set .Printer = .Printers(SavedPrinter)
SavedPrinter = ""
End If
End With
End Sub

which is intended to be used like this:

SetDevice "The selected printer name"
DoCmd.Printout ...
SetDevice ""
 
Jeff Boyce said:
Stuart

That sounds like a feasible work-around for the Access 2007
"print-to-specific-printer" issue! Do you know if this works for Access
2007?

Thanks!

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
Hi Jeff

It certainly looks like it. There's a default printer option in A2007.
Report Design Ribbon->Page Setup->Page Setup->Page->Default/Use Specific

Unfortunately I haven't time to test right now. Maybe this evening if I
return in time.
 
Jeff Boyce said:
Stuart

That sounds like a feasible work-around for the Access 2007
"print-to-specific-printer" issue! Do you know if this works for Access
2007?

Thanks!

--
Regards

Jeff Boyce
www.InformationFutures.net
<SNIP>

Hi Jeff

I just ran a test in A2007 and it does indeed work, just like previous
versions.
All the ceveloper has to do is open the report in design view, get to the
page setup dialog and check the option 'Print to default printer', then use
my code to surround any DoCmd.OpenReport or DoCmd.PrintOut calls.
 
Stuart:

Good to see that the Lancashire Rottweiler's hasn't lost his bite. As you
can see the Staffordshire Bull Terrier's still just about capable of gnawing
in a soggy piece of Winalot.

If you have a moment drop me line to let me know how things are going.

kenwsheridan<at>yahoo<dot>co<dot>uk

Ken Sheridan
Stafford, England
 
Back
Top