Hi,
I have a login screen to check for valid passwords. It has a password text box, an Ok button, and a Cancel button. It works fine if the user click the Ok button. However, if the user chooses to press the enter key once the password is entered, they have to press the enter key twice before the next form opens up. I would like to eliminate this extra key stroke. But i am not sure which event or property to set. Any suggestions? Please see sample code for the Ok button. Thanks.
Private Sub cmdOk_Click()
If txtPassword.Value = "password" Then
'close the password form and go to antoher form
DoCmd.Close
DoCmd.OpenForm "anotherform", acNormal
Else
MsgBox "Sorry....", vbOKOnly, "Important Information:"
txtPassword.SetFocus
End If
End Sub
I have a login screen to check for valid passwords. It has a password text box, an Ok button, and a Cancel button. It works fine if the user click the Ok button. However, if the user chooses to press the enter key once the password is entered, they have to press the enter key twice before the next form opens up. I would like to eliminate this extra key stroke. But i am not sure which event or property to set. Any suggestions? Please see sample code for the Ok button. Thanks.
Private Sub cmdOk_Click()
If txtPassword.Value = "password" Then
'close the password form and go to antoher form
DoCmd.Close
DoCmd.OpenForm "anotherform", acNormal
Else
MsgBox "Sorry....", vbOKOnly, "Important Information:"
txtPassword.SetFocus
End If
End Sub