DAO queryDef

L

LanceR

Im using db.queryDefs(x).Fields.count and db.queryDefs(x).Fields(x).Name to
return information on fields within database queries.
It seems to only be able to "see" the fields in Select and Crosstab queries.
The queryDef object can not "see into" Make Table, Update or Append queries

Is this a limitation or is there a way to get at the field info for the
other query types?

Thank you!!
 
K

Klatuu

It is not a limitation, but the nature of the beast. Select and Crosstab
queries return rows, but Action queries do not. If it cannot return records,
it can't be seen as a recordset.
 
L

LanceR

Hi Klatuu,

With your advise I was able to eliminate the thought of returning a list of
field names from my queries using: db.queryDefs(x).Fields(x).Name
As you said, this does not work for Update, Append or Make table queries.

After a little digging I was able to find a way to get at the field names
for the Action queries.

Db.QueryDefs(x).Name returns the name of all queries.
Using Db.QueryDefs(x).SQL I was able to return a sql statement for the
action queries which does contain all the field names in the query.
Using this sql string I then used a simple "instr()" function to search for
the field names I was interested in to see if they are in the query.
 

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