+ Reply to Thread
Results 1 to 3 of 3

Thread: Hit Enter key

  1. #1
    Registered User
    Join Date
    11-10-2009
    Location
    Sunnyvale, Ca
    MS-Off Ver
    Excel 2003
    Posts
    7

    Hit Enter key

    Hi All,

    I have a form that has a "search" button with serveral text boxes. After the user enter data in the text box(es), the user would hit the "search" button to get the data. I am wondering if I can connected the "search" button to the "ENTER" key (i.e. when "ENTER" key is hit, it automatically run the same code as the "search" button being pressed/hit).

    Any advices?

    Thanks.

  2. #2
    Forum Moderator ConneXionLost's Avatar
    Join Date
    03-11-2009
    Location
    Victoria, Canada
    MS-Off Ver
    2003 & 2010
    Posts
    1,795

    Re: Hit Enter key

    Hi tnguyen,

    Use the text box properties to add code to each text box "On Key Press" event.

    Code:
    If KeyCode = vbKeyReturn Then
    
    '  Put your search button code here
    
    End If
    Cheers,
    Docendo discimus.

    Please consider:
    • Thanking those who helped you. Click the reputation icon in the contributor's post and add Reputation.
    • Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    11-10-2009
    Location
    Sunnyvale, Ca
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Hit Enter key

    I tried the above code, but still not getting it to work. Whenever i click the "Enter" key on my keyboard, it still acts like a "Tab" key.

    Any other sugguestions?

    Thanks!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0