Hi all,
I make log in form with one button name GO. When we click on GO will log in after I entered correct password and username.
Here is my code:
Private Sub cmdgo_Click()
If Me.txtuser = "123" And Me.txtpassword = "123" Then
DoCmd.OpenForm "frmpatient"
DoCmd.Close acForm, "frmlogin"
Else:
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
txtuser = ""
txtpassword = ""
txtuser.SetFocus
End If
End Sub
I don't want to click on button go to log in. After I type username and password already then I press enter so my form will login. I try this code but it is not work.
Private Sub txtpassword_KeyPress(KeyAscii As Integer)
If KeyCode = vbKeyReturn Then
call cmdgo_click
End If
End Sub
Please help me how to do this.