PC Review


Reply
Thread Tools Rate Thread

Buidling query inside of a query using docmd.RunSQL.

 
 
thread
Guest
Posts: n/a
 
      21st Jan 2007
Hi all,

I need to build dinamic query but this query is based on 3 queries on
the way before reaching to this query
does anyone have an example of a query inside of a query?
i have a table that have data of some groups
there is a query for seperate group.
then all the groups query are build merged and making one query that
proccessing data from all of these groups
and last query that building a table from this proccessed query
i would like to make my database dynamic and not limit my groups

 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      21st Jan 2007
A query within a query is called a subquery. Here's an introductory article:
How to Create and Use Subqueries
at:
http://support.microsoft.com/?id=209066

If that gets too complex, and your final query still needs to use other
queries as input "tables", you can create the query statement you need for
the lower level query, and assign it to the SQL property of the QueryDef.
For example, if your final query uses Query1 as a table, you can use:
Dim db As DAO.Database
Dim strSql As String
Set db = CurrentDb
strSql = "SELECT * FROM Table2;"
db.QueryDefs("Query1").SQL = strSql
db.Exeute "Query2", dbFailOnError

For an explanation of why you might prefer the Execute method rather than
RunSQL, see:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"thread" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I need to build dinamic query but this query is based on 3 queries on
> the way before reaching to this query
> does anyone have an example of a query inside of a query?
> i have a table that have data of some groups
> there is a query for seperate group.
> then all the groups query are build merged and making one query that
> proccessing data from all of these groups
> and last query that building a table from this proccessed query
> i would like to make my database dynamic and not limit my groups


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DoCmd.RunSQL woes with update query wkaibigan Microsoft Access Queries 10 3rd Nov 2009 11:50 PM
delete query using docmd.runsql bindurajeesh Microsoft Access VBA Modules 3 16th May 2008 09:46 PM
Q? DoCmd RunSQL Update query niuginikiwi Microsoft Access Form Coding 3 16th May 2007 10:31 AM
query vs docmd.runsql =?Utf-8?B?RGljayBNaW50ZXI=?= Microsoft Access Queries 2 25th Jul 2006 08:41 PM
Array in a Docmd.Runsql query =?Utf-8?B?SXRhbGlhbiBQZXRl?= Microsoft Access VBA Modules 3 6th Dec 2004 02:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:20 PM.