if statment or case statment?
I want to write an if or case statement that opens my form depending on the criteria.
i have tried both neither work.
Code:
If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then lngMyEmpID = Me.cboEmployee.Value Select Case cboEmployee Case "Admin"DoCmd.Close acForm, "frmLogon", acSaveNo DoCmd.OpenForm "Main Page Navigation Form"Case "Other" DoCmd.Close acForm, "frmLogon", acSaveNo DoCmd.OpenForm "Main Page Navigation Form User"End Select 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 your system administrator.", vbCritical, "Restricted Access!" Application.Quit End If End Sub