Application Object.
You can use the DefaultWorkspaceClone method to create a new Workspace object without requiring the user to log in again. For example, if you need to conduct two sets of transactions simultaneously in separate workspaces, you can use the DefaultWorkspaceClone method to create a second Workspace object with the same user name and password without prompting the user for this information again.
Application.DefaultWorkspaceClone
The DefaultWorkspaceClone method uses the following argument.
Argument | Description |
Application | The Application object. |
The DefaultWorkspaceClone method creates a clone of the default Workspace object in Microsoft Access. The properties of the Workspace object clone have settings identical to those of the default Workspace object, except for the Name property setting. For the default Workspace object, the value of the Name property is always #Default Workspace#. For the cloned Workspace object, it is #CloneAccess#.
The UserName property of the default Workspace object indicates the name under which the current user logged in. The Workspace object clone is equivalent to the Workspace object that would be created if the same user logged in again with the same password.
The following example clones the default workspace, then enumerates the properties of each workspace.
Sub CloneWorkspace() Dim wrkDefault As Workspace, wrkClone As Workspace Dim prp As Property ' Get default workspace. Set wrkDefault = DBEngine.Workspaces(0) ' Clone default workspace. Set wrkClone = Application.DefaultWorkspaceClone ' Enumerate properties of each workspace. For Each prp In wrkDefault.Properties Debug.Print ">>>"; prp.Name; " "; prp.Value Next prp For Each prp In wrkClone.Properties Debug.Print ">>>"; prp.Name; " "; prp.Value Next prpSub