Different forms visible for different users

JPed

Registered User.
Local time
Today, 22:24
Joined
Feb 11, 2014
Messages
29
Hi all,

I have found a number of guides/instructions online on how to create a user security on Access 2010 which I have managed to do by creating Login tables with password and security levels.

I have a login screen which opens when the database is opened and the on click command of the login button is as follows:

Code:
Private Sub Command17_Click()
Dim UserLevel As Integer
If IsNull(Me.txtLoginID) Then
    MsgBox "Please enter LoginID", vbInformation, "Login ID Required"
    Me.txtLoginID.SetFocus
ElseIf IsNull(Me.txtPassword) Then
    MsgBox "Please enter password", vbInformation, "Password Required"
    Me.txtPassword.SetFocus
Else
    'process the job
    
    If (IsNull(DLookup("UserLogin", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'"))) Or _
    (IsNull(DLookup("password", "tblUser", "Password = '" & Me.txtPassword.Value & "'"))) Then
        MsgBox "Incorrect LoginID or Password"
    Else
        UserLevel = DLookup("UserSecurity", "tblUser", "UserLogin = '" & Me.txtLoginID.Value & "'")
        DoCmd.Close
            If UserLevel = 1 Then
                DoCmd.OpenForm "Cost per Kg Graphs"
                DoCmd.OpenTable "dbo_job", acViewNormal, acEdit
                
                DoCmd.Close
            
            Else
                DoCmd.OpenForm "Theta A Input"
                DoCmd.OpenForm "Theta D Input"
                DoCmd.OpenForm "Theta F Input"
                DoCmd.OpenForm "Theta A Input"
                DoCmd.OpenTable "dbo_job", acViewNormal, acEdit
                DoCmd.Close
                
            End If
    End If
End If
End Sub

As you can see I have managed to make different forms open when different users log in, however I was wondering if it was possible to make different forms hidden/visible depending on what user logs in? Or perhaps locked/unlocked depending on the user. This is with the aim of making the database less complicated for those operators who are inputting production data, while still allowing the finance/operation managers to access the full amount of queries/forms/tables.
 

Users who are viewing this thread

Back
Top Bottom