list tables in a combo box

virencm

Registered User.
Local time
Tomorrow, 10:06
Joined
Nov 13, 2009
Messages
61
Hi

Is it possible to populate a combo box with a list of all tables in a database and view a tables contents based on the selection made in the combo box?

thanks
Viren
 
Is the purpose of this to open a table to view or edit data?

If it's to edit, then don't. Use forms instead.

To get a list of tables, create a combobox and in the rowsource put this SQL:

Code:
SELECT MSysObjects.Name
FROM MSysObjects
WHERE (((MSysObjects.Type)=1 Or (MSysObjects.Type)=6) AND ((Left([Name],4))<>'MSys'))
ORDER BY MSysObjects.Name;

Objecttype 1 is localtables and objecttype 6 is linked tables.

JR
 
Thank you guys. the website link was very useful for another part that i needed help on and the combo box works perfect with the code provided.

cheers!
Viren
 
the website link was very useful for another part that i needed help on ...
Courtesy of Bob (aka boblarson). One thing you can extract from what is given in Bob's example is the aliasing of report names, you can for example change each to uppercase, UCASE().

Glad it's working for you.
 

Users who are viewing this thread

Back
Top Bottom