Thanks Dawn for all of your help. I've been playing with the code most of the day and discovered the following worked right before your reply.
Thanks again. '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 either main menu or admin menu based on user access level If 1 = DLookup("fldAccess", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then DoCmd.Close acForm, "frmLogon", acSaveNo DoCmd.OpenForm "frmMain" Else If 2 = DLookup("fldAccess", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then DoCmd.Close acForm, "frmLogon", acSaveNo DoCmd.OpenForm "frmAdmin" Else MsgBox "Please see the administrator to set your access level." End If End If 'Original code... To close logon form and open main menu 'DoCmd.Close acForm, "frmLogon", acSaveNo 'DoCmd.OpenForm "frmMain" Else MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!" Me.txtPassword.SetFocus End If Quoting "Crosier, Dawn" <[EMAIL PROTECTED]>: > Try changing your code to: > > If strUserForm = DLookup("fldAccess", "tblEmployees", > "[fldAccess] =" & 1) Then > DoCmd.OpenForm "frmAdmin" > Else > MsgBox "see the administrator" > End If > > Dawn Crosier > Application Specialist > "Education Lasts a Lifetime" > > This message was posted to a newsgroup. Please post replies and > questions to the group so that others can learn as well. > > > -----Original Message----- > From: AccessDevelopers@yahoogroups.com > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Monday, January 23, 2006 8:01 AM > To: AccessDevelopers@yahoogroups.com > Subject: RE: [AccessDevelopers] Trouble adding another condition... > > My fldAccess is an integer field. I did remove the quotes (revised code > below), however when I try to run it I get the "see the administrator > message 2x's and that's it. > > Again, any help is appreciated. > > Thank you. > > 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 > > 'Close logon form and open splash screen > > Dim strUserForm As String > > If strUserForm = DLookup("fldAccess", "tblEmployees", > "[fldAccess] = 1") Then > DoCmd.OpenForm "frmAdmin" > Else > MsgBox "see the administrator" > End If > > If strUserForm = DLookup("fldAccess", "tblEmployees", > "[fldAccess] = 2") Then > DoCmd.OpenForm "frmMain" > Else > MsgBox "see the administrator" > End If > > 'DoCmd.Close acForm, "frmLogon", acSaveNo > 'DoCmd.OpenForm "frmMain" > > 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 > > > > Please zip all files prior to uploading to Files section. > Yahoo! Groups Links > > > > > > > > Please zip all files prior to uploading to Files section. Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AccessDevelopers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/