How to daisy chain queries and use the output from one query as parameter for another

K

Karen Middleton

Hello All

I want to daisy chain a few queries the situation I have is the
following:


Query1
Query2
Query3
Query4

I want to use the output generated from the Query1 as a parameter for
Query2 and the value generated from Query2 as a parameter for
Query3,etc


I tried using the following to daisy chain the queries:

CurrentDb().QueryDefs("Query1").Execute


Appears this cannot be done since the above VBA code cannot execute a
Select query it can run a insert, update or delete query but not a
Select query.

Query1 is something like this:

Select sum(val)/Count(*) from Tab1;

I want to use the value of sum(val)/count(*) called as tempresult in
the following:

select * from tab2 where val2 >= tempresult;


Please clarify how I can accomplish using the following approach:

CurrentDb().QueryDefs("Query1").Execute


Please explain how I can run a Select query from the above code and
use the output into a temporary variable and pass it to the second
query as a parameter.

Thanks
Karen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top