• Print to specific printer (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Print to specific printer (Access 2000)

    Author
    Topic
    #413630

    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

    Viewing 5 reply threads
    Author
    Replies
    • #913793

      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.

      • #913806

        Thanks – thought as much.

        • #915819

          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 .

          • #915832

            Thanks John

            This is a nice piece of work, certainly of use to me cool

          • #915833

            Thanks John

            This is a nice piece of work, certainly of use to me cool

          • #915836

            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.

            • #915842

              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.

          • #915837

            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.

        • #915820

          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 .

      • #913807

        Thanks – thought as much.

    • #913794

      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.

    • #915834

      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.

    • #915835

      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.

    • #915843

      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.

      • #915847

        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.

      • #915848

        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.

    • #915844

      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.

    Viewing 5 reply threads
    Reply To: Print to specific printer (Access 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: