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 Quoting "Crosier, Dawn" <[EMAIL PROTECTED]>: > Is your fldAccess a text field or an integer field? If integer, remove > the quotes. > > 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: Friday, January 20, 2006 2:30 PM > To: AccessDevelopers@yahoogroups.com > Subject: RE: [AccessDevelopers] Trouble adding another condition... > > Thanks Dawn for your help. > > I do have a field called fldAccess for the User Level. I inserted your > code where I thought it would fit in. It appears I placed it in the > right spot, however, I keep getting the "see the administrator" message > on what I believe to be valid data. > > Can somebody please look at my code? > > '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 > > Thanks again. > > > > 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/