Combo Boxes - Common Programming

T

Tatakau

I have several forms that utilize a combination of text fields, check boxes,
combo boxes, etc., and I am trying to streamline the data entry process to
help save time. Specifically, I am trying to make it to where every time a
combo box is updated, the focus is set to the next item in the form. IE,
after selecting a credit card type, Access would automatically move on to the
card number field.

I guess I could just write a Me.FieldName.SetFocus code for every single
combo box, but that would be very tedious to put in, and just as tedious to
take out. Is there a place that I can type code that runs when any combo box
is updated?

Thanks,

Nick
 
B

Brian

Here's half an answer. Put a SendKeys "{TAB 1}" in the AfterUpdate of each
combo box. This way, you don't have to specify where it goes - just make sure
the tab order & tab stops are set correctly.

While this can be done, I wouldn't recommend it if users might also key
their way through the form; if the user is keying through the fields and
presses Tab after typing a partial entry and having it pop up in the combo
box via AutoComplete, your Tab will be in addition to the user's Tab and will
move the user forward an extra field.
 
T

Tatakau

Hmm... that is a very good point. Is it possible to sendkey a tab for a
combo box only if the update was done by selecting the value from the combo
box (either mouse or keyboard)?

Nick
 
B

Brian

Not that I am aware of. Here's a little more detail. Let's say that you
implement a SendKeys Tab.

The user picks Visa in the CCType box using the mouse. The AfterUpdate event
automatically moves the focus to the next box.

The next user decides to type "Vi" in the CCType box, which automatically
brings up "Visa". The user presses Tab to move on, which moves the focus to
the next control, but as this happens, the AfterUpdate event fires, moving
the focus again to the next control after that.

The long & short of it: the only guaranteed way to have the focus where you
want it is to specify it explicitly in the AfterUpdate of the combo box. (You
won't need the "Me.", though; you can just use the control name as long as
you are moving around on the same form.

Private Combo1_AfterUpdate()
Combo2.SetFocus
End Sub

What we wish for is an AutoTab for combo boxes...
 
Top