Value returned by one combo box affects the values in another

  • Thread starter Thread starter David
  • Start date Start date
D

David

I want to use a combo box to select countries based on the
result from another combo box displaying regions. In other
words I would selct a region and the lookup values in the
combo box would change to the countries in the region. How
would this work. I have tried several different approaches
using queries but it does not quite work. Can anyone help
 
I want to use a combo box to select countries based on the
result from another combo box displaying regions. In other
words I would selct a region and the lookup values in the
combo box would change to the countries in the region. How
would this work. I have tried several different approaches
using queries but it does not quite work. Can anyone help

Leave the rowsource of the 2nd combo box blank.
Code the AfterUpdate event of the 1st combo box to fill the rowsource
of the 2nd.
Something like this:

Combo2.Rowsource = "Select tblCountry.CountryID,
tblCountry.CountryName from tblCountry Where tblCountry.Region
= " & Me!ComboName & ";"

Change the table and field names as needed.
The above assumes Region is a Number datatype and the combo box bound
column is Number also.

If Region is a Text datatype, then use
Where tblCountry.Region = '" & Me!ComboName & "';"
 
I assume ComboName refers to the name of Combo1. The table
is structured thus: CountryID (autonumber), Country
(text), Region (text). This is presumably similar to what
you had in mind. Also thank you
 
Back
Top