View Full Version : List tables in a combo or list box


mjdavie
01-31-2002, 02:05 AM
Could anybody tell me how I can list my tables in a list box or combo box,

Thanks in advance
Mat

Pat Hartman
02-01-2002, 05:25 AM
This query will produce a list of all the tables in or linked to your database. You can use it as the recordsource of a combobox.

SELECT MSysObjects.Name, MSysObjects.ForeignName, MSysObjects.Database, MSysObjects.Connect, MSysObjects.Type
FROM MSysObjects
WHERE (((MSysObjects.Name) Not Like "MSys*") AND ((MSysObjects.Type)=1 Or (MSysObjects.Type)=4 Or (MSysObjects.Type)=6));

mjdavie
02-01-2002, 05:34 AM
Cheers Pat, it worked a treat

flavioso
12-09-2008, 12:20 PM
I found this post from aways back, and would like to know if anyone knows a way to open the table from the combo box without having to create a "switchboard"?

I appreciate any help.

Thanks,

Brad

This query will produce a list of all the tables in or linked to your database. You can use it as the recordsource of a combobox.

SELECT MSysObjects.Name, MSysObjects.ForeignName, MSysObjects.Database, MSysObjects.Connect, MSysObjects.Type
FROM MSysObjects
WHERE (((MSysObjects.Name) Not Like "MSys*") AND ((MSysObjects.Type)=1 Or (MSysObjects.Type)=4 Or (MSysObjects.Type)=6));

Pat Hartman
12-10-2008, 08:09 PM
1. I wouldn't open raw tables for a user. I would use forms.
2. Use the BeforeUpdate event of the combo box to run the code to open a form (or if you insist, open a query).