Results 1 to 4 of 4
  1. #1
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123

    Hide Development Tools / Tables / Queries....ect. depending on access level


    Hi
    I have created a simple login form that is based on
    User Name and Password.

    the table contains
    UserName, First Name, Last Name, Password and User Role(dev, admin...ect.)

    How can I change who can access different parts of the database?

    I want all the Development tools only accessable to People who have "dev" as a "User Role"
    Admin can only access the forms related to data entry
    and managers can view all forms but not the tables, querie and tools...ect.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Disable/enable ribbons and navigation pane and shortcut menus based on user role. This is rather complex coding.

    Review

    http://office.microsoft.com/en-us/ac...010341609.aspx

    http://office.microsoft.com/en-us/ac...#_Toc265079114
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    WickidWe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    123
    where can I Find this code
    Below is the code I am Using for my login though there is nothing that takes into account what
    User role the user Has

    Code:
    Private Sub cmdLogin_Click()
    On Error GoTo Err_ErrorHandler
    'Check to see if data is entered into the UserName text box
        If IsNull(Me.txtUserName) Or Me.txtUserName = "" Then
                MsgBox "You must enter a User Name.", vbCritical, "Required Data"
                Me.txtUserName.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.", vbCritical, "Required Data"
                Me.txtPassword.SetFocus
            Exit Sub
        End If
    'Check the values entered against the table data
        If DCount("*", "tblUsers", "[UserName] = '" & Me.txtUserName & "' AND [UserPassword] = '" & Me.txtPassword & "'") = 0 Then
            MsgBox "Either the UserName or Password are incorrect..." & vbCr & vbCr & "Press OK to try again", _
            vbCritical, "Invalid Credentials"
            Me.txtUserName = ""
            Me.txtPassword = ""
            Me.txtUserName.SetFocus
            
            
        Else
            DoCmd.OpenForm "frmButtons"
            DoCmd.Close acForm, "frmLogon", acSaveNo
        End If
        
        
    exit_ErrorHandler:
        Exit Sub
    Err_ErrorHandler:
        MsgBox Err.Description
        Resume exit_ErrorHandler
    End Sub
    at the moment once the User has Logged on and is taken to the frm buttons
    it doesnt matter who logged in.

    Is there a way that the person logged in is remembered by the database so only the specific options for their particular User Role
    Are Used or displayed?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    My code saves the user ID to a textbox on a form that never closes (Main Menu) so it is always available for reference by subseqent code. Another method is a global declared variable. I avoid global variable because they can be a pain during debugging. If the code execution is interrupted the variable will lose its value.

    I don't do much in the way of user restrictions. I do have code for customized ribbon and project settings disable shortcuts and hide navigation pane. I hold down the shift key when opening db to override settings and bypass code so I can do design edts. Anyone aware of the shift key bypass can do the same.

    http://social.msdn.microsoft.com/For...orum=accessdev
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 06-18-2013, 04:41 PM
  2. Replies: 1
    Last Post: 03-08-2012, 08:34 AM
  3. Replies: 9
    Last Post: 02-02-2012, 04:59 AM
  4. Access Runtime 2007 & Development App
    By EddieN1 in forum Access
    Replies: 2
    Last Post: 10-12-2011, 11:08 AM
  5. Access Runtime Development
    By crowegreg in forum Access
    Replies: 2
    Last Post: 08-09-2011, 09:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums