ComboBox with Query List?

B

bamrak

Good morning!
Is it possible to have a combo box with the list being populated by the
names of all the queries/tables/macros. I know i can make the list
manually, but I was curious as to know if there was a way to have
access manage the list and add/delete as the database grows or shrinks.


Thank you in advance!
 
D

Douglas J. Steele

You can get the information from the (normally hidden) MSysObjects system
table.

Queries are:

SELECT [Name]
FROM MSysObjects
WHERE [Type]=5
ORDER BY [Name]

Tables are:

SELECT [Name]
FROM MSysObjects
WHERE [Type] IN (1, 4, 6)
ORDER BY [Name]

(1 are tables in the same database, 6 are linked tables in other databases,
4 are tables linked through ODBC)

Macros would be type -32766, forms would be type -32768, reports would
be -32764 and modules would be -32761.

If you want to unhide the table so that you can work with it, go under Tools
| Options and check System Objects in the Show group on the View tab. (Once
you've created the queries of interest to you, you can uncheck it again and
the queries will continue to work)
 
Top