Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User name lists from workgroup

Status
Not open for further replies.

DickiePotter

Programmer
Jan 8, 2001
30
0
0
GB
Hi,
I am tring to get a list of all the user names in the workgroup file and put them in a field in the database that is being secured by it. How can I do this?

If I cannot enter the values directly as records then can I use the usernames in a lookup for a combo box or list box?

Please help, this has been bugging me for weeks.
It's also a piece of coarsework and is therefor rather urgent!!!

Thanks,
 
Have you checked out the following topic in the help file???

Group Object, Groups Collection, User Object, and Users Collection Example

There are a number of objects in the security side of Access that are accessible from VBA.

Hope this helps. Post if you need more.

Kathryn


 
Here's the section--the "Add New User" part has been stripped. What's left should do what you need (notice the very long With statement--check the code thoroughly before using):

[tt]
Group Object, Groups Collection, User Object, and Users Collection Example

This example illustrates the use of the Group and User objects and the Groups and Users collections..... Finally, it enumerates the Users and Groups collections of the default Workspace object. See the methods and properties listed in the Group and User summary topics for additional examples.

Sub GroupX()

Dim wrkDefault As Workspace

Dim usrLoop As User

Dim grpLoop As Group
Dim grpMember As Group

Set wrkDefault = DBEngine.Workspaces(0)

With wrkDefault
Debug.Print "Users collection:"

' Enumerate all User objects in the default
' workspace's Users collection.
For Each usrLoop In .Users
Debug.Print " " & usrLoop.Name
Debug.Print " Belongs to these groups:"

Next usrLoop

Debug.Print "Groups collection:"

' Enumerate all Group objects in the default
' workspace's Groups collection.
For Each grpLoop In .Groups
Debug.Print " " & grpLoop.Name
Next grpLoop

End With

End Sub[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top