Hi guys,

Im currently having difficulties connecting 2 comboboxes together. 2 of my combobox are the following, 1 combobox for the country and the other one for the city.

So here's the thing, if I'll choose any country from the combobox-country then all of its cities would appear.

I am having hard time connecting it to the backend of my system, I'm using access by the way and if any one could help then your help would be highly appreciated. Thanks in advance!

Regards,
An Intern whose losing his mind.

If you find any sites that will be helpful please contact me, thanks!

Example -
Table1 has two fields:
Country State
Germany Hamburg
Germany Saxony
Germany Holstein
United States Alabama
United States Alaska
United States California

Form has two combo boxes:
cboCountry
cboState

Set the row source of the first combo box (cboCountry) to the following:
SELECT [Table1].[Country] FROM Table1 GROUP BY [Country] ORDER BY [Country];

Set the row source of the second combo box (cboState) to the following:
SELECT Table1.State FROM Table1 WHERE (((Table1.Country)=forms.Form1.cboCountry)) ORDER BY Table1.State;

Then you will need to requery cboState everytime the cboCountry is changed via code:
Private Sub cboCountry_Change()
Me.cboState.Requery
End Sub

There are other ways via code, but hopefully this will get you started.

in the last post, add row before End Sub:
..........
Private Sub cboCountry_Change()
Me.cboState.Requery
''' new row, if you want empty second field after change-optionaly
Me.cboState.Value=" "
End Sub

This article has been dead for over six months. Start a new discussion instead.