I am trying to get a specific form to open once the user has logged on. They enter a username (from combobox) and password then go directly to their specific payrolll record. Here is the code...It doesnt seem to be working, can someone tell me where I have gone worng? Thanks!!
Private Sub cmdLogIn_Click()
'Check to see if data is entered into the Employee 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 Employeestbl to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "Employeetbl", "[EMPID]=" & Me.cboEmployee.Value) Then
MyEMPID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "Loginfrm", acSaveNo
DoCmd.OpenForm "EmployeePayrollfrm", , , "UserName'='me.cboUserName'"
Else
MsgBox "Password Invalid. Please Try Again", vbCritical + 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
End Sub
Private Sub cmdLogIn_Click()
'Check to see if data is entered into the Employee 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 Employeestbl to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "Employeetbl", "[EMPID]=" & Me.cboEmployee.Value) Then
MyEMPID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "Loginfrm", acSaveNo
DoCmd.OpenForm "EmployeePayrollfrm", , , "UserName'='me.cboUserName'"
Else
MsgBox "Password Invalid. Please Try Again", vbCritical + 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
End Sub