Full Version: logon security
UtterAccess Forums > Microsoft® Access > Access Forms
i found this code sample on logon security:
ntLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database.Please contact admin.", _
vbCritical, "Restricted Access!"
End If
the problem is it doesn't work. is there any missing command or statement?
Larry Larsen
I do use the the code your showing with out any issues..
Here's a copy of all my code.

Option Compare Database
Option Explicit
Private intLogonAttempts As Integer

If Me.txtPassword.Value = DLookup("EmpPwd", "tblAppUsers", "[EmpID]=" & Me.cboEmployee.Value) Then
'/ I do some other stuff here....
        MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid Entry!"
    End If
    'If User Enters incorrect password 3 times database will shutdown
    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 3 Then
        MsgBox "You do not have access to this database.  Please contact your system administrator.", vbCritical, "Restricted Access!"
    End If
When you say it doesn't work, exactly what do you mean? Note that since you're only counting three times, you don't need an integer; a byte will do (to save memory).
Where did you Dim intLogonAttempts?
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.