igfp
asked on
Esc and Enter in Form
I have a form with 2 command buttons. One is cancel, and one is ok. I have many text boxes for the user to input. When user presses 'Enter' I want it to go like "ok" and if user presses 'Esc' I want it to make as "Cancel". Any help?
Thanks everyone!
Thanks everyone!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
setting the cancel property to true will activate it's click event when the user presses Esc.
OOPS! YaakovS is correct!
ASKER
Thank man! Points go to you as you were the first to do this! I apreciate both helps. Life savers!!! :p
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then cmd_Click
End Sub