Link to home
Start Free TrialLog in
Avatar of Karen Schaefer
Karen SchaeferFlag for United States of America

asked on

Unable to select Combo on update of record

I have a sample db - with Select Combo builts results for next combo then returns record result on selection of the City Combo.  This all works find, except I am unable to change the Selection for the Country Combo (First Combo) Form1.  Sample attached.  I am using VBA to set combo values.

What am I missing?

karen
Database2.accdb
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

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 Karen Schaefer

ASKER

I was trying to prevent the drop down expandtion on the second pass on selection of the city it is going back to the Country combo  and drop down expands, I need to set focus to the TxtCity, but still be able to make another selection form Country combo.  when I removed the above mentioned code.  this is what happens.

What I a attempting to do:
1.  Select a Country, have dropdown expand on open or onselect of the Country Comob.
2. If Country = 'USA', then display state combo
3. On afterupdate of State, display and expand the list of cities for the particular state selected.
4. Return records for that city.
5.  Allow user to make another Country seelction and repeat the process. Display/Hide as need any of the fields.

Pleae feel free to modify my code to simplify this process.

Thanks,

Karen
I'm not sure if you can effectively dropdown when the combo is selected, so won't go there, but:

In the Open event of the form, clear the RowSource for the State and City combos. This disallows users from selecting a City before they select a State, and a State before they select a Country.

In the Country's AfterUpdate event, set the rowsource for the State, if they select USA. If not:

Me.State.Visible = Me.Country = "USA"

And then set the RowSource for the City for the selected Country.

If USA is selected, then in the State's AfterUpdate, set the RowSource for the City.

In other words, you'd only clear out the values in State and City when the user selects a different value in the Country combo.
Tell us in steps what to do and what to expect starting from opening the form, and show where is the problem.
At what point did this start to "Not work"?

If I comment out the code on the "got focus" event of the country combobox, ...
Then I am able to continue making selections...

...Also not really sure what your Before update code is doing there either...

So, you will have to explain to us what all the code there is supposed to be doing...?

Also, note that It would be simpler if you did not have separate "state" search logic.
The search for all countries could most likely be simplified to:
Country-->State/Province-->City


JeffCoachman
THANKS