list tables in a combo box (1 Viewer)

virencm

Registered User.
Local time
Today, 22:21
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
 

JANR

Registered User.
Local time
Today, 14:21
Joined
Jan 21, 2009
Messages
1,623
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
 

virencm

Registered User.
Local time
Today, 22:21
Joined
Nov 13, 2009
Messages
61
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
 

vbaInet

AWF VIP
Local time
Today, 13:21
Joined
Jan 22, 2010
Messages
26,374
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

Top Bottom