CreateWorkspace Method


Creates a new Workspace object.


Set workspace = CreateWorkspace(name, user, password, type)

The CreateWorkspace method syntax has these parts.




An object variable that represents the Workspace object you want to create.


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


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


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.

Note  Use strong passwords that combine upper- and lowercase letters, numbers, and symbols. Weak passwords don't mix these elements. Strong password: Y6dh!et5. Weak password: House27. Use a strong password that you can remember so that you don't have to write it down.


Optional. A constant that indicates the type of workspace, as described in Settings.



You can use the following constants for type.




Creates a Microsoft Jet workspace.


Creates an ODBCDirect workspace.



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.