Combo Box Auto Updating

friedboudinball

Registered User.
Local time
Today, 10:35
Joined
Sep 27, 2011
Messages
39
I have a form with 3 combo boxes (Country, State, City). i want the user to pick the country, then that limits the values in the State box, which then limits the values in the city box. I have set each combo box to reference (via SQL) the other entry. So i simply need it to refresh or requery each time something changes.

This code works well to requery the data:

Change()

Me.Box1.Requery
Me.Box2.Requery
Me.Box3.Requery

However, it does not always "requery" when i change the Box1. For example, if I select a country (e.g. Poland) then decide I want it to be England, the query does not rerun to select englands cities instead of Polands, even with the requiery built in. i have tried this with AfterUpdate, ON Dirty, etc..


any ideas?
 
Last edited:
i have tried this with AfterUpdate, ON Dirty, etc..

You tried this on AfterUpdate of what object? The combo box itself? The form?
 
both the combo box and the form. Thanks, in advance, for your help.
 
Here is a simple solution. If all fields (country, state, city) are in one table, then each country should have an ID, then each state should have and ID and city too. In this case, country ID will appear as many times as per the states of that country. And then country and state IDs will appear as many times as the cities in each state.

On your Boxes for country, state and city add all ID columns. Then run a simple query command to update the next box in line to show states only where the ID matches the country ID. Hope you have understood me.
 
Already tried that ... see the requery text above. The problem is when i go back to the first one and try to change it does not force a requery on the remainder.
 

Users who are viewing this thread

Back
Top Bottom