How to handle the user pressing the enter key

  • Thread starter Thread starter Corey-g via AccessMonster.com
  • Start date Start date
C

Corey-g via AccessMonster.com

Hi all,

I thought I had this figured out, but obviously not. I have a login form,
and I was getting tired of always having to tab to the login button. So I
thought I would add events to the password field and the buttons "enter"
events.

Well, much to my surprise, I started to get strange errors as soon as the
form loaded and I started to enter my info. Turns out the enter event isn't
the 'Enter" key, but rather when the focus moves to that control...

So I cleaned up the routine so that it wasn't calling the 'click' event of my
login button, and everything is bavk to where it was. Now I am looking for
another way to implement what I had tried with the 'Enter" event. Basically,
I would like to call my btnClick code when the user presses enter in the
password field.

TIA,

Corey
 
Corey

You could use the AfterUpdate event of your password field. When the user
enters their password you call your btnClick code. The only problem will be
"what if there is an incorrect password or login name"?

On my login form for the user to their to enter their User ID and password
, the user then clicks on Enter or click on Exit Database. There has been no
complaints about using the Enter Database button. This method also allows me
to validate the access and return the focus to the User ID if there is an
attempt for an unauthorised access.
 
Corey

You could use the AfterUpdate event of your password field. When the user
enters their password you call your btnClick code. The only problem will be
"what if there is an incorrect password or login name"?

On my login form for the user to their to enter their User ID and password
, the user then clicks on Enter or click on Exit Database. There has been no
complaints about using the Enter Database button. This method also allows me
to validate the access and return the focus to the User ID if there is an
attempt for an unauthorised access.
 
Don't spend any time with this now, as I have figured it out from other posts.


Sorry if anyone responds in the mean time...
 
Don't spend any time with this now, as I have figured it out from other posts.


I set the buttons 'Default' property on the 'Other' tab to Yes...

Sorry if anyone responds in the mean time...
 
Use the Lost Focus event of the password control (forms have controls, tables
have fields)

Me.cmdLogin.SetFocus
 
No problem. What will stop most posts and help others who have a similar
question would be to rate the post that gave you the answer. That will
create an icon with a green check mark. That lets everyone know the question
is answered. Also, when someone searches on questions with answers, it will
come upt.
 

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

Back
Top