I am working on attempting to create user access into a database i've created. I've found directions for making a form and all necessary steps at http://www.databasedev.co.uk/login.html
I've followed the directions all the way through and it works for exactly what I want to a point.
There is one thing that is not working and another I was wondering if someone could help me add to this subject matter.
The first issue I am experiencing is when someone puts in the incorrect password more than 3 times, the program is not closing as it should but continuing to allow the user to enter new password over and over again without closing.
Here is the code for the button that is meant to compair the "Username" and "password", it works great if you know the username and associated password.
Is anyone able to help me out as to why its not shutting down after three unsuccessfull attempts.
The second thing i'd like to add onto this is having access to specific items within the database depending on the person.
For example, I would want 2 administrators with all access, one data entry person, and anyone else read only. Any suggestions?
I've followed the directions all the way through and it works for exactly what I want to a point.
There is one thing that is not working and another I was wondering if someone could help me add to this subject matter.
The first issue I am experiencing is when someone puts in the incorrect password more than 3 times, the program is not closing as it should but continuing to allow the user to enter new password over and over again without closing.
Here is the code for the button that is meant to compair the "Username" and "password", it works great if you know the username and associated password.
Code:
Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this
'matches value chosen in combo box
If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", _
"[lngEmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "frmSplash_Screen"
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 admin.", _
vbCritical, "Restricted Access!"
Application.Quit
End If
End Sub
Is anyone able to help me out as to why its not shutting down after three unsuccessfull attempts.
The second thing i'd like to add onto this is having access to specific items within the database depending on the person.
For example, I would want 2 administrators with all access, one data entry person, and anyone else read only. Any suggestions?