Link to home
Start Free TrialLog in
Avatar of Senniger1
Senniger1

asked on

Access VBA Code to move focus when Tab Key or Enter Key is pressed.

In Access 2010 I have a form with the following fields.
TimeStart  LunchStart  Lunchend  TimeEnd  PTO  Holiday

If a user presses the Tab Key after entering data in the TimeEnd field, I want the cursor to move to the PTO field.  If a user presses the Enter Key after entering data in the TimeEnd field, I want the cursor to move to the Next Record.

Can anyone help me with this?

Thanks in advance!
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
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
You need to adjust the controls Tab Order.  Not precisely sure how to do it in A2010, but in 2007, you would open the form in design mode.  Then select the Arrange tab on the Ribbon and Select Tab Order.  Then adjust the sequence of the controls within the section.

If the current action when it reaches the last control on the form is to jump to the first control on the same record, the you will need to change the FORMs Cycle property (Other tab of the Properties dialog) from "Current Record" to "All REcords"
Avatar of Senniger1
Senniger1

ASKER

This was exactly what I requested.  Worked perfectly!
Disregard, misread the question.