Full Version: logon security
UtterAccess Forums > Microsoft® Access > Access Forms
enrico
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!"
Application.Quit
End If
the problem is it doesn't work. is there any missing command or statement?
Larry Larsen
Hi
I do use the the code your showing with out any issues..
Here's a copy of all my code.
CODE

Option Compare Database
Option Explicit
Private intLogonAttempts As Integer

CODE
If Me.txtPassword.Value = DLookup("EmpPwd", "tblAppUsers", "[EmpID]=" & Me.cboEmployee.Value) Then
'/ I do some other stuff here....
    Else
        MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid Entry!"
        Me.txtPassword.SetFocus
    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!"
        Application.Quit
    End If
SerranoG
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).
fkegley
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.