>

CreateWorkspace Method

Applies To

DBEngine Object.

Description

Creates a new Workspace object.

Syntax

Set variable = CreateWorkspace(name, user, password)

The CreateWorkspace method syntax has these parts.

Part

Description

variable

A variable declared as object data type Workspace.

name

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

user

A String variable that identifies the owner of the new Workspace object. See the UserName property for more information.

password

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


Remarks

Unlike the other methods you use to create data access objects, CreateWorkspace requires that you provide all of its parts. In addition, Workspace objects aren't permanent and can't be saved. Once you create a Workspace object, you can't alter any of its property settings.

You don't have to append the new Workspace object to a collection before you can use it. You append a newly created Workspace object only if you need to be able to refer to it through the Workspaces collection.

If name refers to an object that is already a member of the Workspaces collection, a trappable error occurs.

Once you use CreateWorkspace to create a new Workspace object, a Workspace session is started, and you can refer to the Workspace object in your application.

To remove a Workspace object from the Workspaces collection, close all open databases and then use the Close method on the Workspace object.

See Also

Close Method, Name Property, Password Property, UserName Property, Workspace Object.

Example

This example creates a new Workspace object named Special, and sets its UserName property to "guest."


Dim wspSpecial As Workspace
' Create new workspace.
Set wspSpecial = DBEngine.CreateWorkspace("Special","guest", "")