querying field and object names

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to set up a query that would generate a list of field names
from a table or a list of object names (table names, query names, etc?) I'd
like to use the lists in drop down boxes, but don't know how to generate them.
 
Set these properties for your combo:
Row Source Type Field List
Row Source Table1
using your table name in place of Table1.

It is possible to programmatically loop through the Fields of the TableDef
to get the field names, delimt them, and concatenate them together to make
the RowSource string for a combo that has a RowSourceType of FieldList, but
there is no need to do it programmatically.

If you want to know how to programmatically loop through the Fields of the
TableDef anyway, see the code in this link:
http://allenbrowne.com/func-06.html
 
That's great information, but I was hoping to set criteria for the lists
before displaying them in the combos (i.e. all fields ending in DT), hence
the reference to queries. Is it still possible? and what of lists of the db
objects themselves (again with critieria)?
 
Yes, look at the link to see how to loop through the Fields of the TableDef.

As for the other objects in the database, you can list the tables like this:
SELECT MsysObjects.Name FROM MsysObjects
WHERE (([Type] = 1) AND ([Name] Not Like "~*") AND ([Name] Not Like
"MSys*"))
ORDER BY MsysObjects.Name;

Include type 6 if you want linked tables, and type 4 for ODBC linked tables.

For the other objects, substitute these values in place of the 1:
Queries: 5
Forms: -32768
Reports: -32764
Modules: -32761
 

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

Back
Top