Contextual drop down list

G

Guest

Hi
I have a form with 2 drop down lists. Drop down list #1 is the category
(state), #2 is the sub-category (cities).
I would like to display the sub-category drop down list based on the
category selected in drop down list #1. In other words, if california is
selected in list #1, display california cities in list #2, but if Nevada is
selected, display Nevada cities, etc...
How do i do that?
Thx in advance
Vince
 
G

Guest

In AfterUpdate event for dropdown #1:

If IsNull(DropDown1) Then
'Clear row source
DropDown2.RowSource = ""
Else
'Set row source as appropriate, for example ...
DropDown2.RowSource = "SELECT City FROM Cities WHERE State = '" &
DropDown1 & "'"
End If
'Clear any previously stored data in DropDown2 if DropDown1 has changed value
If DropDown2.ListIndex < 0 Then
DropDown2 = Null
End If
 

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