Keypress for enter in text box

N

Nacho

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
 
R

Rob Bovey

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top