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?
Re: Stupid Enter Key {RESOLVED}
This is what I had, just to make sure the event was firing
VB Code:
Private Sub txtPass_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
msgbox KeyAscii
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:
Private Sub txtPass_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 13 Then Call cmdOK_Click
End Sub