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.
Private Sub Form_Open(Cancel As Integer)
'On open set focus to combo box
Private Sub cboEmployee_AfterUpdate()
'After selecting user name set focus to password field
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"
'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"
'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
If lngMyEmpID = "1" Or lngMyEmpID = "2" Or lngMyEmpID = "3" Then
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "Startup Screen"
'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!"
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?