Results 1 to 4 of 4

Thread: Stupid Enter Key {RESOLVED}

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    112

    Resolved Stupid Enter Key {RESOLVED}

    This is such a stupid problem, its embarrassing how much time I'm spending on it.

    I made a custom login form. When the user hits the Enter key while in the password textbox, I want the form to treat it as though they hit the OK button.

    No problem, right? I'll just catch the Enter keypress in the txtPass_Keypress Event and have it run the command button code.


    No. When I hit enter in the password textbox, it tabs to the next control on the form. In fact, the keypress event is never fired. If I type any other character, the keypress event is fired, but not with the Enter key. What gives? Anyone know what I'm doing wrong?
    Last edited by mikeyc1204; Jul 1st, 2005 at 01:08 PM. Reason: resolved

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    112

    Re: Stupid Enter Key

    Well it works when I use the KeyDown event. Hate Excel.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Stupid Enter Key

    What code do you have in the key_press event?

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Posts
    112

    Re: Stupid Enter Key {RESOLVED}

    This is what I had, just to make sure the event was firing

    VB Code:
    1. Private Sub txtPass_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    2.     msgbox KeyAscii
    3. End Sub

    In testing, a messagebox comes up for every keypress with the ascii code, except the enter key. Just tabs to the next control.


    This is what I would have liked it to be.

    VB Code:
    1. Private Sub txtPass_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    2.     If KeyAscii = 13 Then Call cmdOK_Click
    3. End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width