Results 1 to 9 of 9
  1. #1
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133

    Post Users permissions

    Hello Everyone

    I have a question about Users Permissions , How can I put special permissions for every users ?
    I have three kinds of Users


    1 = Manager
    2 = Financial
    3 = Administer

    of course Manager can control every Forms , but others Users will have special permissions for using Forms

    and also I want to show me user name on Forms : for Example ( When open to me Invoice Form ) there should has textbox , even I know who is using this Form
    Permission.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    First the db is on the network, so users already have to login to windows.
    In the db, I have a tUsers table, with userID, Name, and Level
    USERID, FIRSTN, LASTN, LEVEL
    bob12, bob smith, M (manager)
    pam4, pam jones,"" (user)
    xman, charles, xavier, F (financial)


    when user opens the db, the main menu form will open and grab the userID.
    Then lookup that persons rights in order to enable/disable controls.

    Code:
    sub form_load()
    dim vUserID, vLevel
    
       vUserID =  Environ("Username")      'get userID
    
    'get level from user table
       vLevel = Dlookup("[Level]","tUsers","[userID]='" & vUserID & "'")
    
    'now, enable/disable items on form
       select case vLevel
             case "A"  'admin 
                 'all is enabled
    
             case "U"  'normal user
                 txtBox1.enabled = false
                 txtManager.enabled = false
    
             case "M"  'manager
                 txtBox1.enabled = false
       end select
    end sub

  3. #3
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    thanks a lot for your help
    I will try to use this code in my Project
    but my work finished now , and I have a to go now
    If I can use it without problem , and be good for my project , I will tell you and If I have a problem too , I will tell you too
    thanks again for your help

  4. #4
    jwhite is offline Competent Performer
    Windows 10 Access 2013 32bit
    Join Date
    Dec 2012
    Location
    North Carolina
    Posts
    349
    Relying on valid logins via Environ() function is a BAD idea! There are demos of using security like ranman suggests that have users login with their username and password. An example: http://www.utteraccess.com/forum/Sim...-t1961240.html

  5. #5
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Quote Originally Posted by jwhite View Post
    Relying on valid logins via Environ() function is a BAD idea! There are demos of using security like ranman suggests that have users login with their username and password. An example: http://www.utteraccess.com/forum/Sim...-t1961240.html
    Why, pray tell? Not that I would use the Environ method anyway, but see no reason why the network login ID is never a good idea as you suggest.
    Adding a login form and storing passwords adds a layer of design that serves little purpose IMHO. The link you provided even says that the sample given can be "easily circumvented". Even a password field provides little protection against anyone but the least experienced db user.

    In my defense, how likely is it that people are sharing their network login credentials? Not very, I'd say. It's the way I would go.
    Last edited by Micron; 04-23-2017 at 11:36 PM. Reason: grammar
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    thanks a lot
    it was so useful , but I want to give me permission for users , When I want to set permission for users and say , Only I want this user can open this Invoice , and manager can control all Invoices , or it be same this Video too , it will be so useful : https://www.youtube.com/watch?v=bhQ9mRhks8g

  7. #7
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    To expand upon the solution given, the premise is that you have a user table (tblUsers) which has a field named UserLevel. Anyone who is an admin gets that user level value. Read only the same. Anything else in between is up to you, and you can add more fields if you want to have sub groups on the UserLevel value (you might want to give some supervisors access to certain forms but not to other forms).

    If you have a form (switchboard) from which you are going to navigate to other forms or reports, you either enable or disable those buttons based on the user level value when you open that form. If you want, you can make the check again when opening those forms to ensure unauthorized people don't open them if you think it is possible for them to get into the Access nav pane (which you should set to not be visible when the db opens). The video only shows the interface that the designer created in order to manage the tblUsers UserLevel settings in the table, but they have based it on a form by form basis, which means you need a list of forms in a table. We're saying just assign Joe Smith the level of Admin (or whatever) and code to allow or not, the ability to click the switchboard buttons based on his level, rather than what his level is for every form.

  8. #8
    Mehvan's Avatar
    Mehvan is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2016
    Posts
    133
    thanks a lot for your advice
    I already solved it and now it's working without problems
    thanks again for your help .

  9. #9
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Please mark your threads as solved if you're happy with the outcome.
    Thanks.

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

Similar Threads

  1. Limit users (after Login) permissions.
    By emihir0 in forum Access
    Replies: 4
    Last Post: 11-16-2015, 11:52 AM
  2. Users and permissions mess up
    By rastaplouf in forum Security
    Replies: 1
    Last Post: 09-25-2013, 04:10 PM
  3. Setting up Users, Passwords, and Permissions
    By Degs29 in forum Security
    Replies: 2
    Last Post: 05-31-2013, 03:42 PM
  4. Users logon and permissions
    By eman in forum Programming
    Replies: 10
    Last Post: 10-03-2011, 11:10 PM
  5. Access 2007 Users and Permissions Problem
    By botts121 in forum Security
    Replies: 3
    Last Post: 07-06-2009, 10:23 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