Need help on adding criterie to code (probably simple).

selvsagt

Registered User.
Local time
Today, 15:27
Joined
Jun 29, 2006
Messages
99
hi,

I have a loginform that works great, but would like to add a criteria so that the admin user opens a different splash screen than the "normal" user. I want the adminuser to open the form "sentralbordadmin", not the usual "sentralbord".

I have no idea on how to do this, and hope someone can help.




Code:
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 "Skriv inn brukernavn.", vbOKOnly, "Obligatorisk felt"
            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 "Skriv inn passord.", vbOKOnly, "Obligatorisk felt"
            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
        
        DoCmd.Close acForm, "frmLogon", acSaveNo
        DoCmd.OpenForm "sentralbord"

        Else
        MsgBox "Feil passord", vbOKOnly, "Ugyldig data!"
        Me.txtPassword.SetFocus
    End If
 
Code:
DoCmd.Close acForm, "frmLogon", acSaveNo
strOpenForm = "sentralbord"
if lngMyEmpID = [[I][COLOR="Red"]insertAdminValueHere[/COLOR][/I]] then strOpenForm = strOpenForm & "admin"
DoCmd.OpenForm strOpenForm
 

Users who are viewing this thread

Back
Top Bottom