>

CreateUser Method

Applies To

Group Object, Workspace Object.

Description

Creates a new User object.

Syntax

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

The CreateUser method syntax has these parts.

Part

Description

variable

A variable declared as an object data type User.

object

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

name

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

pid

A String variable containing the PID of a user account. The identifier must contain from 4 to 20 alphanumeric characters. See the PID property for more information on valid personal identifiers.

password

A String variable containing the password for the new User object. The password can be up to 14 characters long and can include any characters except the ASCII character 0 (null). See the Password property for more information on valid passwords.


Remarks

If you omit one or more of the optional parts when you use CreateUser, 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 User object from a collection, use the Delete method on the collection.

See Also

Append Method, Delete Method, Name Property, Password Property, PID Property, User Object.

Specifics (Microsoft Access)

Once you have created a new User object and appended it to the Users collection of a Workspace or Group object, you can verify that the new user exists by examining the Name drop-down list box on the Users 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 User object.


Dim usrPartner As User
Dim strManagersPID As String


strManagersPID = "1122aabb"
' Create new user account.
Set usrPartner = DBEngine.Workspaces(0).CreateUser("Partner", _
strManagersPID) ' Set other properties of usrPartner. usrPartner.Password = "NewPassword" ' Save user account definition by appending it to Users collection. DBEngine.Workspaces(0).Users.Append usrPartner ' Re-create usrPartner and append to Groups collection Set usrPartner = DBEngine.Workspaces(0).CreateUser("Partner") DBEngine.Workspaces(0).Groups(0).Users.Append usrPartner