Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using enter key to submit a form

Status
Not open for further replies.

policechiefwiggum

Programmer
Mar 19, 2006
48
GB
I have a login form that has 2 text fields (username & Password) and 2 buttons (login & Close)
Currently when a user enters their password and hits enter, all that happens is the next item in the tab list is selected (the login button) so the user has to either press the enter key twice or use the mouse - no big deal i know, but i'm getting moaned at!!

Is there any way that when the user presses the enter key it can call / fire the code set against the login button?

i've found this after a quick google but it has no affect - the next field in the tab order is still highlighted
Code:
Private Sub txtFind_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
MsgBox "Enter Key Pressed"
End If

Obviously the above will be modified to run the code i want, once i can get the text box to show

As usual, many thanks in advance for your help :)
 
Set the Default property of your login button to True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top