ok im trying to lock someone out of the database after 3 log in attempts here is what i have:
i know this is wrong
i cannot open the record set with DAO because it gives me an error how can i change contact to be "Yes"?
Code:
Private Sub Ok_Click()
On Error GoTo ErrorRPT
Static LogonAttempts As Integer
Dim SaiCurrentUser As String
SaiCurrentUser = ""
If DLookup("[Contact]", "[User Name]", "[User Name] = '" & Me.User_name.Value & "'") = "Yes" Then
MsgBox "Sorry but you do not have sufficiant rights to access this database.", vbCritical & vbOKOnly, "Error!"
Me.User_name.Value = ""
Me.Password.Value = ""
Me.User_name.SetFocus
Else
If Me.Password.Value = DLookup("[Password]", "[User Name]", "[User Name] = '" & Me.User_name & "'") Then
SaiCurrentUser = [User Name]
Forms![Infokeeper]![Loginname] = SaiCurrentUser
DoCmd.Close acForm, "Login Screen", acSaveNo
DoCmd.OpenForm "Switchboard"
Else
LogonAttempts = LogonAttempts + 1
End If
If LogonAttempts >= 3 Then
MsgBox "You do not have permission to access this database. Your account has been locked. Please contact your database administrator."
DLookup "[Contact]", "[User Name]", "[User Name] = '" & Me.User_name & "'" = "Yes"
Application.Quit
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
Me.Password.SetFocus
Me.Password.Value = ""
End If
End If
GoTo Endsubtxt
ErrorRPT:
Call ErrorRPT1
Endsubtxt:
End Sub
i know this is wrong
Code:
DLookup "[Contact]", "[User Name]", "[User Name] = '" & Me.User_name & "'" = "Yes"
i cannot open the record set with DAO because it gives me an error how can i change contact to be "Yes"?