Results 1 to 7 of 7
  1. #1
    FriQenstein is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    98

    Generating a Report from a Query with a Button

    Greetings,



    I have a Form that allows a user to search for inventory. The user enters text to search for and clicks the Button. This Form pulls info from a Query then shows it on screen with no problems.

    What I'm trying to do is get that Button to not only use the Query but also generate a Report from those Query results... however I'm not able to figure out how to get 2 actions from 1 Button.

    Advise?
    T.I.A.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Create a report based on the query and open the report from the button instead of the query (though a button can easily perform multiple tasks, it doesn't sound necessary in this case).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,389
    Do you have the report defined? If not, highlight the query name in the navigation pane and click Create > Report on the ribbon. Save the report and give it a name, like rptSelectedInventory.
    Now for the button. Does the button click event run an Embedded Macro, or an Event Procedure?
    Last edited by davegri; 01-07-2019 at 11:25 PM. Reason: clarif

  4. #4
    FriQenstein is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    98
    Quote Originally Posted by pbaldy View Post
    Create a report based on the query and open the report from the button instead of the query (though a button can easily perform multiple tasks, it doesn't sound necessary in this case).
    What I had done was, the button was originally setup to run the Query. Then I decided, instead of letting the user see the Query, why not just put it into a Report form instead so it has a better layout.
    Since the Button was already set with the action to call the Query, I just added an action in the Action Catalog to also run the Report.
    I'm understanding what you are saying about not needing the Query as a task, I just wasn't certain how to get the Report generated from the Query without having multiple actions set on that 1 Button.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You should be able to delete the action opening the query and leave the one opening the report. Presuming the report is based on the query, it runs the query itself in the background; you don't have to open it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    FriQenstein is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2019
    Posts
    98
    Quote Originally Posted by pbaldy View Post
    You should be able to delete the action opening the query and leave the one opening the report. Presuming the report is based on the query, it runs the query itself in the background; you don't have to open it.
    Yeppers. That's exactly what I did. Seems to work just fine now. I guess I went the roundabout way of doing it, but at least it sticks in the brain that way.

    Thanks for the assistance.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    No problem and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 12-22-2016, 05:41 PM
  2. Replies: 7
    Last Post: 09-03-2015, 11:31 AM
  3. Generating A Count In A Report
    By McArthurGDM in forum Reports
    Replies: 3
    Last Post: 04-15-2015, 11:26 AM
  4. Query Not generating Chart in report
    By jj1 in forum Access
    Replies: 1
    Last Post: 07-03-2014, 10:59 AM
  5. Help on Generating a Report!
    By ETCallHome in forum Reports
    Replies: 10
    Last Post: 06-22-2011, 01:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums