sujittalukde
Well-known Member
- Joined
- Jun 2, 2007
- Messages
- 520
I am using the following code to call cmd button click when Enter is pressed in Textbox2.
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 13 Then
Call cmdLogin_Click
End If
End Sub
This is not firing the click event instead it sets focus to the Command button and then pressing Enter is firing the event.
I want that instead of focusing the command button, Enter press shall fire the command button click event.
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 13 Then
Call cmdLogin_Click
End If
End Sub
This is not firing the click event instead it sets focus to the Command button and then pressing Enter is firing the event.
I want that instead of focusing the command button, Enter press shall fire the command button click event.