Keypress for enter in text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Nacho said:
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
 
Back
Top