axxess
asked on
Limit Selection in a combo box
In my form, I wish to limit the selection in a combo box based on a value in another another combo box. The source of the data is a table which has two fields, SalesProv and SalesCity. What I want to happen is, when the user selects an entry in the SalesProv combo box, the selection of cities in the SalesCity combo box is limited to the cities belonging to that province.
Any ideas?
Thanks!
Any ideas?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, prepare for users who enter new province and new city that are not in the list.
Sorry folks...was only looking at the basic problem at hand, not application wide. You both are correct and I thank you for commenting so quickly.
ASKER
JC: Thanks, but I'm rather new to VBA. Appreciate details of your solution re "using code to set the RowSource...requery to load City data..". Thanks as well for the helpful comments(Tuvi,LostSoul).
While JCreson's solution is acceptable, you must prepare for all contingencies. For example, the user might want to put the city in before the province. This should be expected as it is the "usual" order of address entry. To allow for this, as users hate being told how to do things by a computer, is to allow the list of cities to contain ALL cities, then have it filtered once a province is selected so, for example, if the user picks "Toronto" then picks "Newfoundland" the "Toronto" selection is changed to a null.