|  | Here is a sample function taken from MS Technet article Q123079 (you can find
this at http://www.microsoft.com/kb)
Hope this helps.
   Function ListGroupsOfUser (UserName As String)
   '****************************************************************
   ' Purpose: Lists the groups to which a specified user belongs.
   ' Accepts: The name of a user.
   ' Returns: A list of groups for the specified user.
   ' Assumes: The existence of a user called Developer in the Admins
   '          group, with no password.
   '****************************************************************
 
   On Error GoTo err_ListGroupsOfUser
 
   Dim MyWorkSpace As WorkSpace, i As Integer
   Dim MyUser As User
 
   ' Create a new workspace as a member of the Admins group.
   Set MyWorkSpace = DBEngine.CreateWorkspace("SPECIAL", "Developer", "")
 
   Set MyUser = MyWorkSpace.Users(UserName)
 
   For i = 0 To MyUser.Groups.count - 1
        Debug.Print MyUser.Groups(i).Name
   Next i
 
   MyWorkSpace.Close
   Exit Function
 
   err_ListGroupsOfUser:
   If Err = 3265 Then
        MsgBox UCase(UserName) & " isn't a valid user name", 16, "Error"
   ElseIf Err = 3029 Then
        MsgBox "The account used to create the workspace does not exist"
   Else MsgBox Error(Err)
   End If
 
   MyWorkSpace.Close
   Exit Function
 
   End Function
[Posted by WWW Notes gateway]
 |