Results 1 to 7 of 7
  1. #1
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50

    Running two queries from a single input parameter

    I am hoping to gain some insight here. Please help!

    I have a report based on a single query (which is working just fine). However, the query outcome is a single line of data most of which is crunching numbers.

    The numbers represent aggregate data from multiple persons which represent multiple agencies.
    What I would like to do is have the multiple agencies listed at the top of the report so that the reader can see what all agencies are making up this aggregate data.

    I have developed a separate query that generates the agencies based on the same input parameter as the query that generates the aggregate data.


    How can I link these so that all I need to do is enter the input parameter (date) one time and flip the switch on both of these queries.

    Since both queries have a common field (the date), I tried combining them but ended up with some sort of circular reference error that shut me down.

    I tried using a subreport but I still ended up having to enter the input parameter twice (sometimes 3 times). I eventually gave me what I wanted but I don't want to have to enter the date multiple times.

    thanks to all,

    Mark

  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,521
    Most of us would use a form to gather the user input. Your queries would get the criteria from there, and thus you would avoid multiple prompts.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    Thanks Paul,
    But Im not sure how to develop the form that would trigger queries.
    any advice?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    At the simplest, a form with a textbox for the date and a button to open the report.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    Thank you Paul,
    I didn't realize that I had used this same solution (and actually on the same form) for a different problem.
    It works great actually.
    Thanks a million.

  6. #6
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    Since solving this thread. I would like to briefly describe the process of using an input on a form to run multiple queries for other 'very amateur' db prgrammers like myself.

    I had two queries that were being used for a single report. They ran based on a single date input parameter. I used one query to create a subreport.

    Every time I would try to run the report I had to enter the date criteria twice (once for each query that was being used to form the report).

    The simple solution was to create a simple text box (I put mine right next to the button that I already had to run the report) format the text box to 'short date', and then go to each query that was asking for that short date and enter the name of that text box into the criteria cell (under 'date') in the query design.

    Going back to the form to run the report, I simply entered the date that I wanted, click on my run report button and both queries would run from that single date-formatted text box.
    Voila'! Problem solved!
    This is a fantastic tool for the toolbox.

  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,521
    Happy to help!
    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: 5
    Last Post: 06-05-2016, 09:23 PM
  2. Replies: 15
    Last Post: 11-26-2015, 11:27 AM
  3. Running queries, VIA VB, but not running in Order
    By mike02 in forum Programming
    Replies: 6
    Last Post: 06-01-2013, 07:07 AM
  4. Replies: 13
    Last Post: 01-10-2012, 09:56 AM
  5. Running parameter queries from VBA
    By John Southern in forum Programming
    Replies: 6
    Last Post: 03-25-2010, 10:24 AM

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