Populating Combo Box With DB Objects

J

JamesJ

Access 2007 sp2.

I want to populate a combo box with Database objects and have that object
open when
selected in the combo box. I'm not sure where to begin.
For instance, I want to populate a combo box with the tables from my back
end db
and when I select one have the table open.

Thanks,
James
 
J

JamesJ

I've found via google the following in the row source of the combo box
displays my back end db tables:

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

I'm just not sure now what to put in the After Update of the combo box tho
open the selected table.

James
 
F

fredg

I've found via google the following in the row source of the combo box
displays my back end db tables:

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

I'm just not sure now what to put in the After Update of the combo box tho
open the selected table.

James

JamesJ said:
Access 2007 sp2.

I want to populate a combo box with Database objects and have that object
open when
selected in the combo box. I'm not sure where to begin.
For instance, I want to populate a combo box with the tables from my back
end db
and when I select one have the table open.

Thanks,
James

DoCmd.OpenTable Me.[ComboBoxName]

Change ComboBoxName to the actual name of your combo box.

Note: while the above will open the selected table, it's not a good
idea to allow users access to tables. Tables are for storing data, not
for user viewing or editing.
 
J

JamesJ

Understood.
Didn't realize it would be so easy.

Thanks,
James

fredg said:
I've found via google the following in the row source of the combo box
displays my back end db tables:

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

I'm just not sure now what to put in the After Update of the combo box
tho
open the selected table.

James

JamesJ said:
Access 2007 sp2.

I want to populate a combo box with Database objects and have that
object
open when
selected in the combo box. I'm not sure where to begin.
For instance, I want to populate a combo box with the tables from my
back
end db
and when I select one have the table open.

Thanks,
James



Change ComboBoxName to the actual name of your combo box.

Note: while the above will open the selected table, it's not a good
idea to allow users access to tables. Tables are for storing data, not
for user viewing or editing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top