Selecting a table for Rowsource

D

Dave

I have a combo box whose data source will be the fields from on of 10
possible tables. I want the user to select which table will provide
the values for the combo box by selecting the table name from a list.
Is this possible? If so, how do I do it?

Thanks in advance, this group is very helpful.

Dave B
 
F

fredg

I have a combo box whose data source will be the fields from on of 10
possible tables. I want the user to select which table will provide
the values for the combo box by selecting the table name from a list.
Is this possible? If so, how do I do it?

Thanks in advance, this group is very helpful.

Dave B

Use 2 combo boxes.
Combo1.....
Set the RowsourceType property of Combo1 to Table/Query.
Set it's Rowsource to:

SELECT MSysObjects.Name FROM MSysObjects WHERE
(((Left([Name],4))<>"MSys") AND ((MSysObjects.Type)=1)) ORDER BY
MSysObjects.Name;

Note: The above Select will display the name of all the user tables in
the database.
If you have just a certain group of tables you wish to use, create a
new table and enter the name of each table you wish to show in the
Combo1 drop-down. Use that New table as rowsource for Combo1.

Code theCombo1 AfterUpdate event:
Me![Combo2.Rowsource = Me!Combo1

In Combo2, set it's RowsourceType property to Field List.

Leave it's Rowsource blank.

When you select a table name in Combo1, Combo2 will display that
table's Field List.
 
Top