473,321 Members | 1,778 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Display users from user and group accounts in a combo box

121 100+
Hi,

I have a form that stamps the underlying table with the current user when a record is created.

I want to be able to run a report by selecting the users that are in the group/user acounts so i need to be able to display the users that have been set up in the user/group accounts in a combo box

Is there anyway of doing this?

Regards Phill
Mar 31 '09 #1
3 1551
ADezii
8,834 Expert 8TB
@phill86
Is there anyway of doing this?
Yes there is, I'll return later with some sample code for you.
Mar 31 '09 #2
ADezii
8,834 Expert 8TB
@phill86
Hello Phil, create a Combo Box on your Form and Name it cboGroupsAndUsers, the code will do the rest. The following code will populate a 2-Column Combo Box with a List of all Groups and Users assigned to those Groups. Be advised that a Group may/may not consist of many Users, and a User can be a Member of 1 or more Groups:
Expand|Select|Wrap|Line Numbers
  1. Dim wrk As DAO.Workspace
  2. Dim grp As DAO.Group
  3. Dim usr As DAO.User
  4. Dim strBuild As String
  5.  
  6. 'To define Column Headers
  7. strBuild = "Groups;Users;"
  8.  
  9. Set wrk = DBEngine.Workspaces(0)
  10.  
  11. With Me![cboGroupsAndUsers]
  12.   .ColumnCount = 2
  13.   .RowSourceType = "Value List"
  14.   .ColumnHeads = True
  15.  
  16.   For Each grp In wrk.Groups
  17.     For Each usr In grp.Users
  18.       strBuild = strBuild & grp.Name & ";" & usr.Name & ";"
  19.     Next
  20.   Next
  21.  
  22.   .RowSource = Left$(strBuild, Len(strBuild) - 1)
  23. End With
  24.  
  25. Set usr = Nothing
  26. Set grp = Nothing
  27.  
  28. wrk.Close
  29. Set wrk = Nothing
  30.  
  31.  
Mar 31 '09 #3
NeoPa
32,556 Expert Mod 16PB
It may also help to consider that Users and Groups (at least in their current form) will probably be discontinued in future versions (if not already removed in A2007).
Apr 4 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Therese A. Sorna | last post by:
Hello all, Is there a way to add users to a secured database without having to go into Security -> User and Group Accounts? I have a table for all employees on a secure database, and want to be...
2
by: Dave N | last post by:
I have a combo box that displays the names of all the users in my "Users" table. I set the RowSource to a Query from the "User" and "Project" tables. I can select any name from the list and that...
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
3
by: Reza | last post by:
Hello I tried this friday, but didn't get anywhere so trying again Basically, I have a fixed list of people that can access the application in the Intranet, and with the policy of the company the...
6
by: Mr Newbie | last post by:
Hi, Im in a situation where I need to restrict users, but I dont have access or wont be allowed access to manage groups in the domain. How can I restrict access is this case ? -- Best...
6
by: Jan | last post by:
Hi: I have created a secured database for a client. For various reasons, I don't want the client to have full persmissions for the database; they aren't in the admins group. I have instead tried...
2
by: Jim in Arizona | last post by:
My goal, somehow, is to populate a dropdownlist with all the user names in active directory. I don't even know where to begin, really. I added a reference to System.DirectoryServices so I could...
4
by: sara | last post by:
Hi - I can't seem to choose the keywords to find an answer to this query - or maybe it's not in the posts. I have a database where the Buyers enter their Orders and then Accounts Payable posts...
2
by: Kaz | last post by:
Hi, I have an Access 2002 database that is accessed by multiple users on a win 2003 server usually in a terminal services envronment. I have a couple of users who unexpectedly cannot know...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.