Part | Description |
group | An object variable that represents the Group you want to create. |
object | An object variable that represents the User or Workspace object for which you want to create the new Group object. |
name | Optional. A Variant (String subtype) that uniquely names the new Group object. See the Name property for details on valid Group names. |
pid | Optional. A Variant (String subtype) containing the PID of a group account. The identifier must contain from 4 to 20 alphanumeric characters. See the PID property for more information on valid personal identifiers. |
Sub CreateGroupX()
Dim wrkDefault As Workspace
Dim grpNew As Group
Dim grpTemp As Group
Dim prpLoop As Property
Dim usrLoop As User
Set wrkDefault = DBEngine.Workspaces(0)
With wrkDefault
' Create and append new group.
Set grpNew = .CreateGroup("NewGroup", _
"AAA123456789")
.Groups.Append grpNew
' Make the user "admin" a member of the
' group NewGroup by creating and adding the
' appropriate Group object to the user's Groups
' collection.
Set grpTemp = .Users("admin").CreateGroup("NewGroup")
.Users("admin").Groups.Append grpTemp
Debug.Print "Properties of " & grpNew.Name
' Enumerate the Properties collection of NewGroup. The
' PID property is not readable.
For Each prpLoop In grpNew.Properties
On Error Resume Next
If prpLoop <> "" Then Debug.Print " " & _
prpLoop.Name & " = " & prpLoop
On Error GoTo 0
Next prpLoop
Debug.Print "Users collection of " & grpNew.Name
' Enumerate the Users collection of NewGroup.
For Each usrLoop In grpNew.Users
Debug.Print " " & _
usrLoop.Name
Next usrLoop
' Delete the new Group object because this
' is a demonstration.
.Groups.Delete "NewGroup"
End With
End Sub