+ Reply to Thread
Results 1 to 3 of 3

Keypress for enter in text box

  1. #1
    Nacho
    Guest

    Keypress for enter in text box

    I have desingned a Worksheet that access information on Access mdb. I need to
    complete criteria in a text box and I want to trigger the VBA routine when I
    press return key (keypress for ASCII 13) but it does not seems to work

    Here is an example of what I'm doing:

    Private Sub txtibs_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    If KeyAscii = 13 Then
    Sheets("Base").cmdfind.Click
    End If
    End Sub

    Any ideas?

    Thanks,
    from Argentina,
    Ignacio

  2. #2
    Rob Bovey
    Guest

    Re: Keypress for enter in text box

    "Nacho" <Nacho@discussions.microsoft.com> wrote in message
    news:C9FC752F-F87B-42E7-BAA9-3DFD89F0AEFA@microsoft.com...
    >I have desingned a Worksheet that access information on Access mdb. I need
    >to
    > complete criteria in a text box and I want to trigger the VBA routine when
    > I
    > press return key (keypress for ASCII 13) but it does not seems to work
    >
    > Here is an example of what I'm doing:
    >
    > Private Sub txtibs_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    > If KeyAscii = 13 Then
    > Sheets("Base").cmdfind.Click
    > End If
    > End Sub


    Hi Ignacio,

    The KeyPress event doesn't fire in a UserForm in response to the Enter
    key. You'll need to use the KeyDown event instead.

    --
    Rob Bovey, Excel MVP
    Application Professionals
    http://www.appspro.com/

    * Take your Excel development skills to the next level.
    * Professional Excel Development
    http://www.appspro.com/Books/Books.htm



  3. #3
    Chip Pearson
    Guest

    Re: Keypress for enter in text box

    Don't use the KeyPress event. Use the KeyUp event.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "Nacho" <Nacho@discussions.microsoft.com> wrote in message
    news:C9FC752F-F87B-42E7-BAA9-3DFD89F0AEFA@microsoft.com...
    >I have desingned a Worksheet that access information on Access
    >mdb. I need to
    > complete criteria in a text box and I want to trigger the VBA
    > routine when I
    > press return key (keypress for ASCII 13) but it does not seems
    > to work
    >
    > Here is an example of what I'm doing:
    >
    > Private Sub txtibs_KeyPress(ByVal KeyAscii As
    > MSForms.ReturnInteger)
    > If KeyAscii = 13 Then
    > Sheets("Base").cmdfind.Click
    > End If
    > End Sub
    >
    > Any ideas?
    >
    > Thanks,
    > from Argentina,
    > Ignacio




+ Reply to Thread

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.6.0 RC 1