>

CreateGroup Method

Applies To

User Object, Workspace Object.

Description

Creates a new Group object.

Syntax

Set variable = object.CreateGroup([name[, pid]])

The CreateGroup method syntax has these parts.

Part

Description

variable

A variable declared as object data type Group.

object

The variable name of the User or Workspace object you want to use to create the new Group object.

name

A String variable that uniquely names the new Group object. See the Name property for details on valid Group names.

pid

A String variable 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.


Remarks

If you omit one or both of the optional parts when you use CreateGroup, you can use an appropriate assignment statement to set or reset the corresponding property before you append the new object to a collection. After you append the object, you can alter some but not all of its property settings. See the individual property topics for more details.

If name refers to an object that is already a member of the collection, a trappable error occurs when you use the Append method.

To remove a Group object from a collection, use the Delete method on the collection.

See Also

Append Method, Delete Method, Group Object, Name Property, PID Property.

Specifics (Microsoft Access)

Once you have created a new Group object and appended it to the Groups collection of a Workspace or User object, you can verify that the new group exists by examining the Name drop-down list box on the Groups tab of the User And Group Accounts dialog box. This dialog box is available by pointing to Security on the Tools menu and then clicking User And Group Accounts.

Example

This example creates a new Group object.


Dim grpManagers As Group, strManagersPID As String
strManagersPID = "2222abc"
' Create new Group object.
Set grpManagers = DBEngine.Workspaces(0).CreateGroup("Managers", _
    strManagersPID)
' Create new group in workgroup by appending it to Groups collection.
Workspaces(0).Groups.Append grpManagers