Share via

Opening a report using a command button

Anonymous
2010-10-18T21:56:15+00:00

How can I open a report using a command button. The report opens from the navigation pane using the open command, but when I create a command button, the button will not open the report.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2010-10-19T21:14:50+00:00

    And if you're not getting IntelliSense, compile the code and fix whatever errors are reported.

    1. Open any code module
    2. Select Compile from the Debug menu.

    "Scottgem [MVP]" wrote in message news:*** Email address is removed for privacy *** .com...

    Hello and thanks for the response. This is what I thought was happening

    However, after correcting the code it still does not do what I am looking for. What happens now when the command button is selected is the report runs the underlying query (which is good), but it sends the report directly to the printer. I need to have the report open to the screen so I can select, copy and paste to another application.

    Thanks for your help.

    DoCmd.OpenReport stDocName, acPreview

    Intellisense is our friend, when you first type in the command after hitting the space bar, Intellisense will show all the arguments for the command with suggestion on how what to enter. There is also the Help screens. Looking up Open Report will show you the parameters for the command.


    Hope this helps, Scott<> P.S. Please post a response to let us know whether our answer helped or not. Microsoft Access MVP 2009 Author: Microsoft Office Access 2007 VBA Technical Editor for: Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports and Queries


    Regards, Graham R Seach Sydney, Australia

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2010-10-19T21:13:12+00:00

    Thank you very much. It works.

    Was this answer helpful?

    0 comments No comments