![]() |
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 |
Keypress for enter in text box
"Nacho" wrote in message
... 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 |
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" wrote in message ... 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 |
All times are GMT +1. The time now is 01:06 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com