Results 1 to 11 of 11
  1. #1
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36

    Limit Selections in Combo Box to Certain Users


    Hello,

    I am working with Access 2013 and would like to limit the selections in a combo box depending who the user is using the database. For example, I have 5 choices in a combo box: Technical, Operational, Capability, Oversight, and Coaching. My goal is to make "Coaching" selectable for only a certain group of people. Just FYI, the form which contains the combo box already recognizes who the user is by using the Environ(Username) code to grab the username.

    Thanks in advance!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What is the Row Source of the Combo Box and the Row Source Type?

  3. #3
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36
    The Row Source Type is a Table/Query, and the Row Source is pulling the "ID" and "Buckets" from tblBuckets and displaying the names of the certain buckets (i.e. Technical, Operational, Capability, Oversight, and Coaching)

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is there a field in the tblBuckets whose field would allow you to limit the appropriate selections?

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What I'm leading up to is another query that would present the appropriate select in the ComboBox. You could then switch the Row Source in the OnLoad event of the form or mayte even the OnEnter event ofn the ComboBox. What you want to avoid if possible is *hard* coding the group of users into the ComboBox events.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Could be as simple as adding a level or sort field to the table and modifying the query to show everything < that value, which is in a hidden form text box, for example. Or the query could call a function which does the same (preceded by an operator such as < but I'm not sure if the operator and returned function value are compatible). One could use a Select Case block to run the appropriate qry or sql statement on form open. Or the aforementioned level could be linked to the user table. Many ways to skin this cat. For what it's worth, I use fosUserName, not the environ value.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36
    What if I created a table that contains each of my employees, their ID #'s, and each category they are associated with? There would be multiple records for each employee but, there must be some code that'll work easier with that.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'm not sure to whom you are talking but that new table to which you refer would probably work just fine in a query that limited the selection to the current employee. It could refer to your form and be the RowSource of your ComboBox.

  9. #9
    wily_wolf is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Feb 2016
    Posts
    36
    I normally don't create tables containing repetitive information but there aren't that many employees so I just thought I'd throw the idea out there to whomever. Would I make the query pull the user information, or do it in VBA?

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Let the query do the work.

  11. #11
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Quote Originally Posted by wily_wolf View Post
    I normally don't create tables containing repetitive information but there aren't that many employees so I just thought I'd throw the idea out there to whomever. Would I make the query pull the user information, or do it in VBA?
    Sometimes it is inevitable, and it's still just a one-to-many relationship that happens all the time. That does not mean the data is not normalized, just that in some cases, it can't be normalized further. I guess I've been lucky enough so far to have been able to sort permissions in a logical fashion, give them sort order id's and just coded to allow access to anything less than 3 for one type, less than 5 for another, etc.
    Last edited by Micron; 03-22-2016 at 09:58 PM. Reason: clarification

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. Limit Data that Users see in Database
    By katkth7533 in forum Access
    Replies: 6
    Last Post: 02-11-2015, 08:09 AM
  3. Replies: 5
    Last Post: 12-17-2014, 10:31 AM
  4. Limit users to their Department
    By Zachrareth in forum Programming
    Replies: 7
    Last Post: 09-09-2013, 08:17 AM
  5. Limit times users can login
    By rcoreejes in forum Access
    Replies: 2
    Last Post: 06-28-2013, 06:13 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