press enter in textfield, execute lines and close form

  • Thread starter A.J.M. van Rijthoven
  • Start date
A

A.J.M. van Rijthoven

I've made a login form.
The user has to type in username and password, after clicking the OK
button the program is checking if the user exists and if te password
is correct. After this it closes the login form (modal form)
How do I achieve that the program processes the check on
username/password and closes the form when I press enter in the
username field (thus not having to click the OK-button)
I've allready tried it with the getfocus property of the OK button
(after pressing enter in the password field, the OK-button gets the
focus and starts to process the code. When I do this, I get an
errormessage that a form cannot be closed when it's being processed.
When I press the OK-button the same code is processed without
errormessage!!)
The second thing I tried is with the keypress property. However I did
not get the program to respond on the enter-key....

How do I solve my little problem??

Thnx in advance
 
A

Alex White MCDBA MCSE

Am I missing something but the default property for the OK button should be
set to yes, this should mean pressing the enter button anywhere on the form
should emulate the clicking of the OK button, have I read your question
correctly?
 
A

A.J.M. van Rijthoven

Not quite, only pressing the enter button in the password or perhaps
username field should emulate teh clicking of the OK button..
 
Top