Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / February 2008

Tip: Looking for answers? Try searching our database.

DAO queryDef

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LanceR - 01 Feb 2008 17:54 GMT
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!!
Klatuu - 01 Feb 2008 20:18 GMT
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.
Signature

Dave Hargis, Microsoft Access MVP

> Im using db.queryDefs(x).Fields.count and db.queryDefs(x).Fields(x).Name to
> return information on fields within database queries.
[quoted text clipped - 5 lines]
>
> Thank you!!
LanceR - 07 Feb 2008 14:39 GMT
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.

> 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,
[quoted text clipped - 9 lines]
> >
> > Thank you!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.