Greetings,
I’m trying to modify a login form that was developed by a former employee.
I used the following code:
Code:
Private Sub cmdLOGIN_Click()
'Check to see if data is entered into the UserName and password box matches to tblLOGIN
If IsNull(Me.txtUserNm) Then
MsgBox "Please enter User Name", vbOKOnly, "Required Data"
Me.txtUserNm.SetFocus
ElseIf IsNull(Me.txtPWD) Then
MsgBox "Please enter Password", vbOKOnly, "Required Data"
Me.txtPWD.SetFocus
Else
'Check to see if data entered into the UserName and Password box matches to tblLOGIN
If (IsNull(DLookup("USERNM", "tblLOGIN", "USERNM = '" & Me.txtUserNm.Value & "' And PWD = '" & Me.txtPWD.Value & "'"))) Then
MsgBox " **Invalid Username or Password **!"
Exit Sub
Else
MsgBox "Password Is Invalid - Try Again!", vbCritical + vbOKOnly, "INVALID PASSWORD"
Me.txtInvalidPW = "Y"
Me.txtAttempts = Me.txtAttempts + 1
If Me.txtAttempts = 3 Then
MsgBox "Check Password And Try Again" & vbCrLf & " GOOD-BYE", vbCritical + vbOKOnly, "TRY AGAIN LATER"
Exit Sub
DoCmd.Quit
Else
Me.txtPWD.SetFocus
Me.cmdLOGIN.Enabled = False
End If
Exit Sub |
I’ve attached a summary document to show my test result and mods. I would like to see.
Any suggestions?
TIA
Regards,