[AccessD] FW: Query SQL

John Colby jcolby at colbyconsulting.com
Sat Jun 28 12:30:52 CDT 2003


Guys,

I have figured out how to get the query names from an external database
using something like:

SELECT MSysObjects.Name FROM MSysObjects IN 'X:\DISNEW\DISCO_FE.mdb' WHERE
(((Left$([name],3)='qmm')=True) AND ((MSysObjects.Type)=5));

Which returns only stored queries where the name begins with QMM (mail merge
queries in my system).  I can place this sql (built up on-the-fly) into a
rowsource of a combo box and voila, my user can select a query out in an
external db.

Now I need to get the field names from this same query to populate another
combo.  If the query were local to the database I could just place the query
name itself into the combo row source and set the rowsource type to Field
list, which is indeed what I was doing in the past.  Since the query is now
not local to the mail merge database (I'm turning it into a wizard) I have
to figure out another way.  The SQL thing above is cool because I don't have
to use automation to get the query names.  Does anyone know how to view the
fields in a querydef using sql?  I kind of figured it would be in one of the
msys tables but no joy there.

Eventually I will also have to actually execute the query out in the
external db to get a dataset with which to do the mail merge but if I can
get the sql I can also splice in the IN clause to do this without
automation.

John W. Colby
www.colbyconsulting.com




More information about the AccessD mailing list