My counter LoginFailedCount is not counting. Can any Guru help me?
Private Sub Command8_Click()
Dim strPassword As String
Dim strExistPassword As String
Dim strLogin As String
Dim LoginFailedCount As Double
If IsNull(Me.txtPassword) Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Else
strPassword = Me.txtPassword.Value
strLogin = "'" & Me.txtuser.Value & "'"
strExistPassword = DLookup("password", "tblstaff", "[login] = " & strLogin)
If strExistPassword = strPassword Then
DoCmd.Close acForm, "frmmenu1", acSaveNo
DoCmd.OpenForm "frmmenu", acNormal, , , , acHidden
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
LoginFailedCount = LoginFailedCount + 1
If LoginFailedCount > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", vbCritical, "Restricted Access!"
Application.Quit
End If
End If
End Sub
Private Sub Command8_Click()
Dim strPassword As String
Dim strExistPassword As String
Dim strLogin As String
Dim LoginFailedCount As Double
If IsNull(Me.txtPassword) Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Else
strPassword = Me.txtPassword.Value
strLogin = "'" & Me.txtuser.Value & "'"
strExistPassword = DLookup("password", "tblstaff", "[login] = " & strLogin)
If strExistPassword = strPassword Then
DoCmd.Close acForm, "frmmenu1", acSaveNo
DoCmd.OpenForm "frmmenu", acNormal, , , , acHidden
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
LoginFailedCount = LoginFailedCount + 1
If LoginFailedCount > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", vbCritical, "Restricted Access!"
Application.Quit
End If
End If
End Sub