jjc9809
asked on
Another Access 2007 Logon Question
Hi everyone,
I decided to ask a new question on the Access 2007 LOGON. I need to have a msg box appear when a password is entered that is not in the database when a user enters one.
My coding:
Private Sub Form_Open(Cancel As Integer)
'On open set focus to combo box
Me.cboEmployee.SetFocus
End Sub
Private Sub cboEmployee_AfterUpdate()
'After selecting user name set focus to password field
Me.txtPassword.SetFocus
End Sub
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
End If
'Close logon form and open splash screen
If lngMyEmpID = "1" Or lngMyEmpID = "2" Or lngMyEmpID = "3" Then
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "Startup Screen"
Else
DoCmd.OpenForm "StartupScreen2"
End If
'If User Enters incorrect password 3 times database will shutdown
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
End Sub
Where can I put some coding to chek for the incorrect entery of a password that does not exist in the sstem when entered by a user?
LOGON-FORM-001.jpg
I decided to ask a new question on the Access 2007 LOGON. I need to have a msg box appear when a password is entered that is not in the database when a user enters one.
My coding:
Private Sub Form_Open(Cancel As Integer)
'On open set focus to combo box
Me.cboEmployee.SetFocus
End Sub
Private Sub cboEmployee_AfterUpdate()
'After selecting user name set focus to password field
Me.txtPassword.SetFocus
End Sub
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
End If
'Close logon form and open splash screen
If lngMyEmpID = "1" Or lngMyEmpID = "2" Or lngMyEmpID = "3" Then
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "Startup Screen"
Else
DoCmd.OpenForm "StartupScreen2"
End If
'If User Enters incorrect password 3 times database will shutdown
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
End Sub
Where can I put some coding to chek for the incorrect entery of a password that does not exist in the sstem when entered by a user?
LOGON-FORM-001.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works real good.