The login works Great but Login attempts dose not im still new to VB so i must be overlooking something.
Code:
Private Sub Ok_Click()
Dim LogonAttempts As Integer
Dim SaiCurrentUser As String
SaiCurrentUser = ""
LogonAttempts = 0
If Me.Password.Value = DLookup("[Password]", "[User Name]", "[User Name] = '" & Me.User_name & "'") Then
SaiCurrentUser = [User Name]
DoCmd.Close acForm, "Login Screen", acSaveNo
DoCmd.OpenForm "Switchboard"
Else
LogonAttempts = LogonAttempts + 1
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.Password.SetFocus
Me.Password.Value = ""
If LogonAttempts > 3 Then
MsgBox "You do not have permission to access this database.Please contact your database administrator."
Application.Quit
End If
End If
End Sub