Keycode capture on Login form

K

Ken Warthen

I have a login form I've created for an Access 2007 database. There are
three controls on the form; a username and password textbox, and a command
button. When a user enters his name and password and then clicks on the
command button I have code that validates the username and password, and if
correct allows the end user access to the database.

I would like the end user to be able to hit the [ENTER] key after typing in
his password and have that keystroke invoke the code for the command button.
In it's current state the end user must tab to the command button and click
it to invoke the login process. This seems like a couple of unnecessary
steps. Can anyone give me direction on how to proceed?

TIA,

Ken Warthen
(e-mail address removed)
 
J

Jeff Boyce

Ken

One approach would be to add code to the Exit event of the Password control.
That code would "click" the button.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
K

Ken Warthen

Jeff,

Thanks for the help. I wouldn't have guessed that the Exit event would fire
when the [ENTER] key is pressed, but it works.

Ken

Jeff Boyce said:
Ken

One approach would be to add code to the Exit event of the Password control.
That code would "click" the button.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Ken Warthen said:
I have a login form I've created for an Access 2007 database. There are
three controls on the form; a username and password textbox, and a command
button. When a user enters his name and password and then clicks on the
command button I have code that validates the username and password, and
if
correct allows the end user access to the database.

I would like the end user to be able to hit the [ENTER] key after typing
in
his password and have that keystroke invoke the code for the command
button.
In it's current state the end user must tab to the command button and
click
it to invoke the login process. This seems like a couple of unnecessary
steps. Can anyone give me direction on how to proceed?

TIA,

Ken Warthen
(e-mail address removed)
 
J

Jeff Boyce

Ken

It works if you have Access set to leave the control when you press <Enter>.
Likewise, it will work if you press <Tab>, or use your mouse to click
elsewhere.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Ken Warthen said:
Jeff,

Thanks for the help. I wouldn't have guessed that the Exit event would
fire
when the [ENTER] key is pressed, but it works.

Ken

Jeff Boyce said:
Ken

One approach would be to add code to the Exit event of the Password
control.
That code would "click" the button.

Regards

Jeff Boyce
Microsoft Office/Access MVP

Ken Warthen said:
I have a login form I've created for an Access 2007 database. There are
three controls on the form; a username and password textbox, and a
command
button. When a user enters his name and password and then clicks on
the
command button I have code that validates the username and password,
and
if
correct allows the end user access to the database.

I would like the end user to be able to hit the [ENTER] key after
typing
in
his password and have that keystroke invoke the code for the command
button.
In it's current state the end user must tab to the command button and
click
it to invoke the login process. This seems like a couple of
unnecessary
steps. Can anyone give me direction on how to proceed?

TIA,

Ken Warthen
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top