Results 1 to 4 of 4
  1. #1
    JeffGeorge is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    111

    Form Event On Enter


    I have a very simple form that consists of a data entry field and a command button. When the command button is clicked a report is called that executes a query based on whatever is entered in the field. I would like to be able to simply hit Enter after typing the data and have it do the same thing. However, when I add the same macro command to this unbound text box as I am using for the command button, nothing happens when I hit Enter. In fact, the related report opens at the same time I open the form and runs the query with no criteria. How can I add functionality similar to the 'click on command button' to this unbound text box?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Put your code in the After Update event of the text box.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    JeffGeorge is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2013
    Posts
    111
    That worked perfectly; thank you. I thought I had tried that but I had probably just messed everything up by all of the different things I tried. Thanks again.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    For future reference, Command Buttons have a property named 'Default.' If you set a Command Button's Default Property to Yes, hitting <Enter> is the same as clicking on the Command Button.

    Obviously, only one Command Button per Form can have its Default set to Yes.

    To set the Default, in Form Design View
    • Select the Command Button
    • Go to Properties - Other
    • Set Default Property to Yes

    Linq ;0)>

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Field auto enter new line on enter event
    By Ruegen in forum Forms
    Replies: 3
    Last Post: 09-17-2013, 09:00 PM
  2. Replies: 1
    Last Post: 08-24-2012, 06:50 AM
  3. Replies: 3
    Last Post: 05-07-2012, 12:17 PM
  4. Replies: 1
    Last Post: 08-15-2011, 03:20 PM
  5. Replies: 0
    Last Post: 03-06-2010, 10:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums