Never Hide
Registered User.
- Local time
- Tomorrow, 00:12
- Joined
- Dec 22, 2011
- Messages
- 96
I have a form with a few comboboxes that I have created using the combobox wizzard to get data from my database's tables. To, hopefully, make my problem easier to understand I'll just use these simple tables to give you an idea of how I have build my data to work
Address: (AddressName,AddressNumber,PostCode,CityID)
City: (CityID,CityName,CountryID)
Country: (CountryID,CountryName,ContinentID)
Continent: (ContinentID,ContinentName)
In my form I have a combobox for each of my tables and each combobox has all the fields from the responding table so using the "combobox.Column()" i can get the data I want to use in my code.
This is the code in the Address combobox:
This is the code in the City combobox:
And so on as you move up the ladder..
When you select the Address,the responding City is automaticaly selected. The problem is that this is where it stops. And what I mean is that it doesn't give you the responding Country for that City and so on.When I select the Address and I get the City, then I have to manually go and the select the City to get the Country-even if I don't even change the selection of the City,just open the dropdown of the comboCity combobox and immediately close it.
Any ideas about how to solve this problem? Maybe I should be using a different event other than the "AfterUpdate" one?
Any contructive input is greatly appreciated
Edit: I forgot to mention that I have also tried using the "On Change" event with the same results
Address: (AddressName,AddressNumber,PostCode,CityID)
City: (CityID,CityName,CountryID)
Country: (CountryID,CountryName,ContinentID)
Continent: (ContinentID,ContinentName)
In my form I have a combobox for each of my tables and each combobox has all the fields from the responding table so using the "combobox.Column()" i can get the data I want to use in my code.
This is the code in the Address combobox:
Code:
Private Sub comboAddress_AfterUpdate()
Dim cityID as String
cityID=Me.comboAddress.Column(3)
Me.comboCity=DLookup("CityID","City","[CityID]= '" & citryID & "'")
End Sub
Code:
Private Sub comboCity_AfterUpdate()
Dim countryID as String
countryID = Me.comboAddress.Column(3)
Me.comboCountry = DLookup("CountryID","Country","[CountryID]= '" & countryID & "'")
End Sub
When you select the Address,the responding City is automaticaly selected. The problem is that this is where it stops. And what I mean is that it doesn't give you the responding Country for that City and so on.When I select the Address and I get the City, then I have to manually go and the select the City to get the Country-even if I don't even change the selection of the City,just open the dropdown of the comboCity combobox and immediately close it.
Any ideas about how to solve this problem? Maybe I should be using a different event other than the "AfterUpdate" one?
Any contructive input is greatly appreciated

Edit: I forgot to mention that I have also tried using the "On Change" event with the same results
Last edited: