Execute Command Button click event when pressing ENTER in a text box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RyanT
    New Member
    • Mar 2008
    • 5

    Execute Command Button click event when pressing ENTER in a text box

    Access 2000
    Windows XP

    I have a small form with two text boxes:
    - User ID
    - Password

    The form also has two command buttons:
    - Login
    - Cancel

    I would like to set things up so the user can type in his/her ID, click Tab and enter his/her password, then simply press ENTER to login. Right now, when I press ENTER the form sets the focus on the Login button, but I have to press ENTER a second time to execute the click event for that button.

    Can this be done?
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Sure! In Design View for the form, select the Login Button the goto Properties Sheet - Other and set the Default Property to Yes. Any time the <Enter> key is pressed, no matter where the focus is, the Login Button will fire.

    Linq ;0)>

    Comment

    Working...