Automate moving to the next control on a form

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

Guest

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top