Automate moving to the next control on a form

S

shun

I am creating a form for the user to enter the duration of time it took to
build a component. I need to the time entered in minutes and seconds. I
have created two text boxes to accept both. My question is once the user
has entered the minutes how can I make the focus automatically move to the
seconds text box?

Shun
 
W

Wayne Morgan

If you are enforcing the number of digits to be entered, you can do this.
Otherwise, the user will need to press the Tab key to move to the next
control in the tab order. Make sure the two controls are listed sequentially
in the tab order for the form, regardless of which of these two methods are
used.

To have the focus move automatically to the next control, set the AutoTab
property (Other tab) of the minutes control to Yes or True. If you've
limited the control to 2 digits, then after the 2nd digit is entered, Access
will automatically tab to the next control in the tab order. Adjust the
number of digits to match your situation.
 
R

Ron Hinds

You could do it in the AfterUpdate event of the first text box. Let's say
the first text box is called txtMinutes and the second is called txtSeconds.
Here is the code:

Private Sub txtMinutes_AfterUpdate()
txtSeconds.SetFocus
End Sub
 
Top