Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change SQL of subquery

Status
Not open for further replies.

tekkyun

Technical User
Oct 23, 2003
122
GB
I have a series of select subqueries which provide data for a make table query. What I am trying to do is design a form which allows users to select particular criteria via drop-down menu selection which will then be applied to one of the subqueries before the maketable query is run.
I have written the sql for each of the menu selections but how do I apply and save this sql to the subquery before running the maketable query?
 
Thought I would just add that I have currently got around the problem by changing the select subquery to a make table query, then saving the data set to temp table that is then queried by the next query. By changing this subquery from select to action I can then use Runsql method to amend sql as I want.
Is there a better way of doing this without having to create temp table?
 
a temp table would probably be the quickest solution...

however, if you want, you can just open up the sql of the query object and set it to whatever you want...

something like

dim qy as querydef
set qy = querydefs("qryName")

qy.sql = "whatever your sql is"
qy.execute

--------------------
Procrastinate Now!
 
Crowley16,
I am using ADO code. What is equivilant of QueryDef in ADO?
 
Think I have found what I want in thread 701-948011, ie using ADOX code library.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top