Link to home
Start Free TrialLog in
Avatar of axxess
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!
ASKER CERTIFIED SOLUTION
Avatar of JCreson
JCreson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LostSoul
LostSoul

I always use the "On click" event rather that the "After Update" as it implies the action is triggered only after the data is saved to the table.  Anyways...

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.


Avatar of tuvi
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.
Avatar of axxess

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).