Results 1 to 7 of 7

Thread: Print to specific printer?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    367

    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.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Print to specific printer?

    VB Code:
    1. Application.ActivePrinter = "Black S400 on Ne02:"

    this is code for excel, guess it should work in access too

    pete

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    367

    Re: Print to specific printer?

    That doesn't work for me.

    I don't have the method ActivePrinter as one of my options.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Print to specific printer?

    sorry i don't use access so i can't help you

    pete

  5. #5
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    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.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    367

    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.

  7. #7
    Fanatic Member Dnereb's Avatar
    Join Date
    Aug 2005
    Location
    Netherlands
    Posts
    863

    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
  •  



Click Here to Expand Forum to Full Width