CreateWorkspace Method
Creates a new Workspace object.
Syntax
Set workspace = CreateWorkspace(name, user, password, type)
The CreateWorkspace method syntax has these parts.
Part | Description |
---|---|
workspace | An object variable that represents the Workspace object you want to create. |
name | A String that uniquely names the new Workspace object. See the Name property for details on valid Workspace names. |
user | A String that identifies the owner of the new Workspace object. See the UserName property for more information. |
password | A String 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. |
type | Optional. A constant that indicates the type of workspace, as described in Settings. |
Settings
You can use the following constants for type.
Constant | Description |
---|---|
dbUseJet | Creates a Microsoft Jet workspace. |
dbUseODBC | Creates an ODBCDirect workspace. |
Remarks
Once you use the CreateWorkspace method to create a new Workspace object, a Workspace session is started, and you can refer to the Workspace object in your application.
Workspace objects aren't permanent, and you can't save them to disk. Once you create a Workspace object, you can't alter any of its property settings, except for the Name property, which you can modify before appending the Workspace object to the Workspaces collection.
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 refer to it through the Workspaces collection.
The type option determines whether the new Workspace is a Microsoft Jet or ODBCDirect workspace. If you set type to dbUseODBC and you haven't already created any Microsoft Jet workspaces, then the Microsoft Jet database engine will not be loaded into memory, and all activity will occur with the ODBC data source subsequently identified in a Connection object. If you omit type, the DefaultType property of DBEngine will determine which type of data source the Workspace is connected to. You can have both Microsoft Jet and ODBCDirect workspaces open at the same time.
To remove a Workspace object from the Workspaces collection, close all open databases and connections and then use the Close method on the Workspace object.