Results 1 to 3 of 3
  1. #1
    Join Date
    May 2010
    Posts
    67

    Unanswered: How do I fire an event when pressing the ENTER key

    Good Day!

    I would like to allow the user the ability to update the database with data on the form, by simply pressing the ENTER key.

    Can I program this into access?

    Thanks, in advance!

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Set the KeyPreview property of the form to True (in the Event tab), then use this code:
    Code:
    Private Sub Form_KeyPress(KeyAscii As Integer)
    
        If KeyAscii = 13 Then
        '
        ' Code to save the data on the form
        '   
        End if
    
    End Sub
    Have a nice day!

  3. #3
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by eva.thaeh View Post
    Good Day!

    I would like to allow the user the ability to update the database with data on the form, by simply pressing the ENTER key.

    Can I program this into access?

    Thanks, in advance!
    Is the form bound or unbound?

    I normally create a command button that saves the record. To make the enter key click this command button, set the commnd button's Default property to Yes
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •