Howto make Combobox requery based on dependant combobox values

S

Shane

I'm trying to make a form that has two combo-boxes. One displays the field
list from my table, and the other is supposed to requery to show only values
from that field. However, I can't figure out what code to use.

I want it to be something such as:
SELECT tblIP.[Me.cboSearch.Value] FROM tblIP;

Where tblIP is the table and cboSearch is the field-list combo-box. Of
course that statement doesn't work, but how would I implement this? Please
be aware that the first combo-box displays the "field-list" and not values
from the table. Would I have to create a separate table to have just the
fields listed as values?

Shane
 
B

Brendan Reynolds

Shane said:
I'm trying to make a form that has two combo-boxes. One displays the
field
list from my table, and the other is supposed to requery to show only
values
from that field. However, I can't figure out what code to use.

I want it to be something such as:
SELECT tblIP.[Me.cboSearch.Value] FROM tblIP;

Where tblIP is the table and cboSearch is the field-list combo-box. Of
course that statement doesn't work, but how would I implement this?
Please
be aware that the first combo-box displays the "field-list" and not values
from the table. Would I have to create a separate table to have just the
fields listed as values?

Shane


In the AfterUpdate event procedure of the first combo box ...

Me.NameOfSecondComboBoxHere.RowSource = "SELECT tblIP.[" &
Me.cboSearch.Value & "] FROM tblIP"
Me.NameOfSecondComboBoxHere.Requery
 

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