DefaultWorkspaceClone Method
Applies To
Application object.
Description
You can use the DefaultWorkspaceClone method to create a new Workspace object without requiring the user to log on 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.
Syntax
application.DefaultWorkspaceClone
The DefaultWorkspaceClone method has the following argument.
Argument | Description |
|
application | The Application object. |
Remarks
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 on. The Workspace object clone is equivalent to the Workspace object that would be created if the same user logged on again with the same password.
See Also
BeginTrans, CommitTrans, Rollback methods ("DAO Language Reference"), Name property ("DAO Language Reference"), Password property ("DAO Language Reference"), User object, Users collection.
Example
The following example clones the default Workspace object, then lists the properties of each Workspace object.
Sub CloneWorkspace()
Dim wrkDefault As Workspace, wrkClone As Workspace
Dim prp As Property
On Error Resume Next
' 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 prp
End Sub