none
Print/Email/Export buttons on a report RRS feed

  • Question

  • I have the requirement to display a report, then offer actions such as Print, Email and Export for the user from that report.

    I planned on creating two versions of the report, one that will display in Report View and will have the three buttons (Print/Email/Export) with code behind them

    Print - docmd.openreport in normal mode

    Email - send object command

    Export - docmd.outputto

    The report that I want to print/email/export will be the same report as displayed but without the buttons.

    I plan on just calling this other report (without the buttons), but need to use the same WHERE criteria when printing/emailing/exporting

    When I call the report with the buttons, I use WHERE criteria in the Docmd.openreport function. Is there a way I can reference this from the report when calling the report without the buttons to print/email/export?

    If there is an easier way please let me know. The requirement is to kind of preview the report then decide an action to do on it. Right clicking the preview and print/send to/export wont work I don't think, because I need to populate the send in the email, the format in the export, etc, so it will be a little smarter with less need for user input.

    Thank you for your help

    Tuesday, March 3, 2020 7:52 PM

Answers

  • I can think of several easier ways. For one, if you set the DisplayWhen property of the buttons to Screen Only, they won't print.

    Another is to open in Print Preview mode and have the users use the print buttons in the Ribbon, rather than on a report.

    A third is to offer a Preview and a Print button where the report is launched from.


    -Tom. Microsoft Access MVP

    • Marked as answer by JHarding08 Thursday, March 5, 2020 11:21 PM
    Tuesday, March 3, 2020 9:08 PM

All replies

  • I can think of several easier ways. For one, if you set the DisplayWhen property of the buttons to Screen Only, they won't print.

    Another is to open in Print Preview mode and have the users use the print buttons in the Ribbon, rather than on a report.

    A third is to offer a Preview and a Print button where the report is launched from.


    -Tom. Microsoft Access MVP

    • Marked as answer by JHarding08 Thursday, March 5, 2020 11:21 PM
    Tuesday, March 3, 2020 9:08 PM
  • I'll try the DisplayWhen option first. That seems the easiest. Will it just have a blank area where the buttons are when printing/emailing/exporting?
    Wednesday, March 4, 2020 5:18 PM
  • The DisplayWhen is working well.

    My one question - for Email and Export, I'd like to name the attachment/export file with a custom name for the context. I know the trick to do this is to open another version of the report in hidden view with the name and send that one.

    Is there an easy way to open another version of the report I am in with the same WHERE criteria that the one opened in Report View has? 

    Thursday, March 5, 2020 6:13 PM