How can I show selections that are based on another selection?

G

Guest

I am trying to design a database that keeps track of where our customers
fields are. We are trying to do this in a State>County>Township fashion. How
can I set it up so that when I choose the State, the next list will only show
the counties for that state? And then next list would only show the townships
for that county?

Is this possible?
Thanks-
Bryan
 
G

Guest

Just set up a single table which defines all the combinations:
State
County
Town
Initially your query is SELECT State
When a state is chosen, your query becomes SELECT County WHERE State =
"ChosenState".
When a town is chosen, your query becomes SELECT Town where State =
"ChosenState" AND County = "ChosenCounty"

You could use a single combo box to handle the selections. Just change the
rowsource and do a requery each time.

-Dorian
 
A

Armen Stein

I wouldn't do it with a single table - that would require a lot of duplicate
data for States and Counties.

Set up separate tables for State, County and Town. The County table has a
relationship with State. The Town table has a relationship with County.

On the form: In the AfterUpdate on cboState, set the County to Null and
change it's RowSource to include Where State = cboState. In the AfterUpdate
on cboCounty, set the Town to Null and change it's RowSource to include
Where County = cboCounty.

Also, when the form first opens or OnCurrent fires, set the Rowsources above
so that they are correct initially.
 

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