Code:Private Sub cmdLogin_Click() Static count As Integer 'Check if data is entered in the Employee Id box' If IsNull(Me.txtEmployeeId) Or Me.txtEmployeeId = "" Then MsgBox "You must enter an Employee Id.", vbOKOnly, "Required Data" Me.txtEmployeeId.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 EmployeeId = Nz(DLookup("strEmployeeId", "tblEmployeeLogin", "StrEmployeeId='" & Me.txtEmployeeId & "'"), "") Password = Nz(DLookup("strPassword", "tblEmployeeLogin", "strPassword='" & Me.txtPassword & "'"), "") If Me.EmployeeId = EmployeeId And Me.txtPassword = Password Then MsgBox "Access Granted", vbInformation, "Logging into Database" DoCmd.Close DoCmd.OpenForm "Menu" Else MsgBox "Access Denied" count = count + 1 If count = 3 Then MsgBox "You have failed to login on three tries", vbCritical, "Exiting...." DoCmd.CloseDatabase End If End If End SubPrivate Sub Login_Click() Static count As Integer 'Check if data is entered in the Employee Id box' If IsNull(Me.txtEmployeeId) Or Me.txtEmployeeId = "" Then MsgBox "You must enter an Employee Id.", vbOKOnly, "Required Data" Me.txtEmployeeId.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 EmployeeId = Nz(DLookup("strEmployeeId", "tblEmployeeLogin", "StrEmployeeId='" & Me.txtEmployeeId & "'"), "") Password = Nz(DLookup("strPassword", "tblEmployeeLogin", "strPassword='" & Me.txtPassword & "'"), "") If Me.EmployeeId = EmployeeId And Me.txtPassword = Password Then MsgBox "Access Granted", vbInformation, "Logging into Database" DoCmd.Close DoCmd.OpenForm "Menu" Else MsgBox "Access Denied" count = count + 1 If count = 3 Then MsgBox "You have failed to login on three tries", vbCritical, "Exiting...." DoCmd.CloseDatabase End If End If End Sub