Key Handle on Error Pop Up

bballhermit

Registered User.
Local time
Today, 11:33
Joined
Oct 14, 2010
Messages
40
I have a login form that handles the "Enter" key always selecting the "Login" button. However, when incorrect credentials are provided, a pop-up is displayed notifying the user. When pressing "Enter" on the pop-up to select "Ok," the keypress is carried through to my login form, thus trying to login again with the same credentials. How do I cause the key handle to only be applied when there is no error being displayed? Thanks.
 
How are you setting the login button to be the default? Are you setting its DEFAULT property to YES, or some other way?
 
I am not totally sure what you mean. This is my VB code:

'Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
'
' If KeyCode = vbKeyReturn Then
' Call cmdLogin_Click
' End If
'
'End Sub
 
Ah, just remove that code and then go select the button while the form is in design view and in the Properties Dialog on the OTHER tab, set the property named DEFAULT to YES.
 
Wow, ok, can you tell I'm new to Access? That worked easy. Thanks for your help!
 
Wow, ok, can you tell I'm new to Access? That worked easy. Thanks for your help!

Hey, not a problem and you might not know this but there are a lot of experienced Access users/developers out there who don't know about that one.

Oh, and by the way there can only be one button with DEFAULT set to YES on the form. But also you can set the CANCEL property to YES for a button (as long as it isn't a default) and it will be triggered when you hit the ESC key.
 

Users who are viewing this thread

Back
Top Bottom