Combo Boxes - KeyDown/AfterUpdate/Lost focus interactions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I inherited this database about 8 months ago, and there were "Lost Focus"
events after certain fields were entered. In some cases these event would
interfere with the use of the navigation buttons.

I changed the events to be AfterUpdates, and things went well. Eventually I
put in some KeyDown events on the combo boxes so the users could use the up
or down arrow to navigate the lists. this was all Access 2000

The office is switching to XP/Office 2003, and I am told that the up/down
arrow code is causing an error, I think it was 777-You've used the ListIndex
property incorrectly...

So to get around it, I eventually went back to the lost focus events...which
calculate and (sometimes) populate other fields in the form. Now I'm back to
getting annoying navigation behavior.

Any thoughts/suggestions/enlightenment would be helpful...thanks all!
 
To have the arrow keys navigate up and down the drop down list doesn't
require any code once the list is open, the normal behavior is to navigate
up and down the list. To open the list, you can use Alt+Down Arrow. If you
wanted to bypass using the Alt key, you could use the key down event to
check for the down arrow key and if the drop down wasn't open, then open it,
otherwise do nothing. To see if the drop down is already open you could use
the code form this link.

http://www.mvps.org/access/api/api0052.htm
 
Thanks for the reply, Wayne. I did not know that about opening the list with
Alt + {DOWN}...I know my "clients" and that's 2 more keystrokes they don't
want to to. But like the neverending battle to educate the users, I will
start preaching this new trick.

I did get things to work by moving the code for checking the ancilary fields
to the Before Update events and putting an error trap in the KeyDown for the
2 combos that still had issues. I trapped (and ignored) error 7777, and it
seems to be working right now, with no hesitations from calculating those
ancilary fields when navigating to a different record.
 
Back
Top