Results 1 to 10 of 10
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Praha
    Posts
    967
    Thanks
    52
    Thanked 104 Times in 89 Posts

    Print to specific printer (Access 2000)

    I've a command button that prints a report - created using the toolbox wizard. At no point does it offer me the option to choose which printer to print to. Access does not pick the set default printer, but the last one to be printed to, which is a pain.
    How can I specify the printer ?
    The generated code is short - as follows:

    Dim stDocName As String

    stDocName = "Envelopes Home Christmas"
    DoCmd.OpenReport stDocName, acNormal

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print to specific printer (Access 2000)

    You can open the report in preview mode and display the print dialog:

    stDocName = "Envelopes Home Christmas"
    DoCmd.OpenReport stDocName, acViewPreview
    RunCommand acCmdPrint

    Unfortunately, Access 2000 VBA doesn't offer much in the way of controlling the printer.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Praha
    Posts
    967
    Thanks
    52
    Thanked 104 Times in 89 Posts

    Re: Print to specific printer (Access 2000)

    Thanks - thought as much.

  4. #4
    New Lounger
    Join Date
    Sep 2003
    Location
    Melbourne, Victoria, Austria
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print to specific printer (Access 2000)

    Have a look at the attached sample db, it may be of some help to you. This is not my work, the authors name in shown in the module.

    I put the Print button on the form for testing .

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Print to specific printer (Access 2000)

    Thanks John

    This is a nice piece of work, certainly of use to me <img src=/S/cool.gif border=0 alt=cool width=15 height=15>
    Jerry

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Print to specific printer (Access 2000)

    The nature of Access is that the report is saved with a printer, either the default or a specific printer. It sounds like you may be opening and saving the report in design mode with a particular printer set, rather than the default printer. Also, make sure you have the latest service pack for Office 2000 applied. There were printer issues with the vanilla version of 2000.
    Charlotte

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Print to specific printer (Access 2000)

    That works well, but those who want to use it should be aware that selecting a printer sets it as the system-wide default printer. The change will affect not only the report to be printed, but all Windows applications.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Print to specific printer (Access 2000)

    Well spotted Hans,

    This could be an issue in my area of work as we have locked down the addition and removal of Printers in our Windows 2000 builds for general users. I am set up as administrator on my build and it certainly confused my printer folder for a while as I had two default printers set at one point until I cleared it out manually. Although impressed by the code, I would suggest that loungers proceed with a little caution if using this as an enhancement and ensure they test it fully.
    Jerry

  9. #9
    2 Star Lounger bobdog's Avatar
    Join Date
    Jan 2001
    Posts
    108
    Thanks
    3
    Thanked 5 Times in 4 Posts

    Re: Print to specific printer (Access 2000)

    There's a much more direct way to do this. Send your report to Print Preview. The Printer dialog is available there. I use Preview as the default for my reports so that users know what they're about to print - it's helpful particularly when filters are involved and the user may not be sure which records have been selected.

    A screen print of the standard form I use for all my apps is attached, allowing a choice of reports for the currently selected set of records. The listbox is fixed and loaded from code when the form opens, which makes adding a new report easy. It could just as easily be driven by a small table.

    Regardless of what filter is in effect, the user can print just the current record, the current set, or all records (the active filter is saved to a variable and then restored after the report is processed.) The can also select one report after the other before they close the dialog. As the screen opens, Preview and Print are disabled until the user selects a report from the listbox.

    I'll post a sample db if there's interest in it.

  10. #10
    New Lounger
    Join Date
    Sep 2003
    Location
    Melbourne, Victoria, Austria
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Print to specific printer (Access 2000)

    Jezza, Thank you for your comments.

    Bobdog,

    I agree with you re the preview. On my forms which require a report to be printed I have both a Print and Preview button , when they choose preview it open the report with a toolbar that has a printer icon and a close icon. I have not been asked once to remove the preview button .
    If it is not too much trouble would you please post a copy of you db.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •