Login of users and super users

Aidanb

Registered User.
Local time
Today, 12:33
Joined
Sep 7, 2008
Messages
20
Hi Might be a Thread in here with this but wouldn't have a clue what to put in to get a result so here i go.

I have a database system in 2003 2000 compatable and i want the user to be a ble to login to there personal area so they can request days off and request holidays, ect.

I also want my super users to be able to login in the same way and then get access to a menu where they can add a user in there department, authorize the holiday and do other tasks.

is there a way that this could be done with out having to build seprate login forms for user and super user login in each department would this be done through a tick box and if so how would i check this through the code that would be used to validate the user and load up there area?.

Hope someone can help me out on this.

Regards

Aidan
 
Here's how I did it. In the employee table, assign them either user or super user. In the login form, on the submit buttons on click event enter this code. What it does is checks the username and password. If they are correct, the code looks at the user's rights and opens the corresponding switchboard. There should be a switchboard for users and another one for super users.

Code:
Private Sub Submit_Click()
'Check to see if data is entered into the UserName combo box
    If IsNull(Me.Combo6) Or Me.Combo6 = "" Then
      MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
        Me.Combo6.SetFocus
        Exit Sub
    End If
    'Check to see if data is entered into the password box
    If IsNull(Me.Password) Or Me.Password = "" Then
      MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
        Me.Password.SetFocus
        Exit Sub
    End If
    'Check value of password in tblEmployees to see if this
    'matches value chosen in combo box
    If Me.Password.Value = DLookup("Password", "Employee", _
            "[EmployeeID]=" & Me.Combo6.Value) Then
        EmployeeID = Me.Combo6.Value
 
        'Check to see if password is default
        If Me.Password.Value = "changeme" Then
        DoCmd.OpenForm "change Password", acNormal, , "EmployeeID=" & Me!Combo6, acFormEdit, acDialog
        End If
 
        'Open appropriate switchboard
        Dim strAccessLevel As String
        Dim strForm As String
 
        strAccessLevel = Nz(DLookup("User_TypeID", "Employee", "[username] = '" & Me.Combo6.Column(1) & "'"), "2")
 
        Select Case strAccessLevel
        Case 1
        strForm = "Menu_Admin"
 
        Case 2
        strForm = "Menu"
 
        End Select
 
        DoCmd.OpenForm strForm
        'Close logon form and open splash screen
        DoCmd.Close acForm, "Login", acSaveNo
    Else
      MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
            "Invalid Entry!"
        Me.Password.SetFocus
    End If
    'If User Enters incorrect password 3 times database will shutdown
    intLogonAttempts = intLogonAttempts + 1
    If intLogonAttempts > 100 Then
      MsgBox "You do not have access to this database.Please contact admin.", _
               vbCritical, "Restricted Access!"
        Application.Quit
    End If
End Sub
 
Thank you speakers_86 looks just like what i want will try it out.

Thanks again.
 
To be honest i have not been doing much past few weeks as had alot on with work so have put the self taught programming on the back burner for a while.
 

Users who are viewing this thread

Back
Top Bottom