One query runs other queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have written 5 queries. Each one makes a table that the next query uses as
input. I am only interested in the results of the last query. Is there a way
to "link" all the queries so I just need to run one and the others are
executed in order?
 
The easiest way would be via a button on a form. The
code to run the queries is straight forward:-
Docmd.setwarnings false '**Turns warning messages off
Docmd.OpenQuery "Query1"
Docmd.OpenQuery "Query2"
Docmd.OpenQuery "Query3"
Docmd.OpenQuery "Query4"
Docmd.OpenQuery "Query5"
Docmd.setwarnings true '**Turns warning messages on
 
It is rarely necessary to do this. You can use a query as a table in most
cases.

Of course, your case may be the exception to the rule. Can you post the SQL
statements you are using? If you do, someone might be able to help you.

Example.
Select Max(ActionDate) as MaxDate, UserID
From SomeTable

Save that as queryA
SELECT UserID, ActionDate, Cost
FROM SomeTable INNER JOIN QueryA
 
Back
Top