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

<*> 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/
 


Reply via email to