-
I have a text box and I want to be able to program it so that when you hit the "Enter" key, it automatically runs the event procedure of a button that I also have on the form. How can I do this?
------------------
Ryan
[email protected]
ICQ# 47799046
-
Try this:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
' Remove the word Rem from the following line, if you also want to remove text from the TextBox when Enter is pressed
Rem Text1.Text = ""
Command1.Value = True
End If
End Sub
P.S. This is post no. 9999... :)
------------------
Yonatan
Teenage Programmer
E-Mail: [email protected]
ICQ: 19552879
-
Thanks! It works great.
------------------
Ryan
[email protected]
ICQ# 47799046
-
how about the RaiseEvent command?
RaiseEvent command1_click
or does this only work in class modules?
------------------
Wossname,
Email me: [email protected] :)