|
-
Jul 3rd, 2006, 10:07 AM
#1
Thread Starter
Hyperactive Member
Print to specific printer?
I am using Access 2000 and need a little help printing a report to a specific printer. I already have the code to open the report using a macro. But, I am having trouble coming up with code that will print this report to a specific printer on a server.
-
Jul 5th, 2006, 06:18 AM
#2
Re: Print to specific printer?
VB Code:
Application.ActivePrinter = "Black S400 on Ne02:"
this is code for excel, guess it should work in access too
pete
-
Jul 5th, 2006, 03:32 PM
#3
Thread Starter
Hyperactive Member
Re: Print to specific printer?
That doesn't work for me.
I don't have the method ActivePrinter as one of my options.
-
Jul 6th, 2006, 02:55 AM
#4
Re: Print to specific printer?
sorry i don't use access so i can't help you
pete
-
Jul 6th, 2006, 04:17 AM
#5
Re: Print to specific printer?
I've ripped this from som of my code, and think it will help you on your way
in the initial code i select a printer in a listbox to make it active
It might be usefull to you to see how to read out the names of the availeble printers as well (to check if the printer is installed).
Sub SelectPrinter()
Dim Prn As Printer
Dim Names() As String
Dim I As Integer
ReDim Names(Application.Printers.Count - 1)
For I = 0 To Application.Printers.Count - 1
Names(I) = Application.Printers(I).DeviceName
Debug.Print Application.Printers(I).DeviceName
Next
'code to select the printer in a form
'...
'...
'...
'me lstSelectPrinter is a listbox with 2 columns (first is an index )
'Set Application.Printer = Application.Printers(Me.LstSelectPrinter - 1)
Set Application.Printer = Application.Printers(2)
End Sub
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
-
Jul 6th, 2006, 01:36 PM
#6
Thread Starter
Hyperactive Member
Re: Print to specific printer?
I have no clue on what this coding is supposed to be doing. It looks like it runs through all the printers, but I don't see how I have it print to a specific printer.
-
Jul 6th, 2006, 02:48 PM
#7
Re: Print to specific printer?
I do cycle through the printers in the original code to populate a list box
the printer is set based on the index in the of the listbox if the print button is hit to provide you with code that works without the form i simplified it tot this statment at the end:
Set Application.Printer = Application.Printers(2)
it selects the third printer
I couldn't use specific names in the example because my printers and plotters aren't yours of course
To print to a specific printer you need to cycle through all available printers until you find the one you desire And set the application printer to the index of the printer you wanted. (it's ofcourse wise to store the original printer name to reset the Application.printer to it's original setting on ending your code.
Last edited by Dnereb; Jul 6th, 2006 at 02:58 PM.
 why can't programmers keep and 31 Oct and 25 dec apart. Why Rating is Useful
for every question you ask provide an answer on another thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|