Class Workspaces (DAO VBA)
A Workspaces collection contains all active, unhidden Workspace objects of the DBEngine object. (Hidden Workspace objects are not appended to the collection and referenced by the variable to which they are assigned.) To use a Workspaces class variable it first needs to be instantiated, for example
Dim wrks as Workspaces
Set wrks = Workspaces
Append
Adds a new Workspace to the Workspaces collection.
The appended object becomes a persistent object, stored on disk, until you delete it by using the Delete method. The addition of a new object occurs immediately, but you should use the Refresh method on any other collections that may be affected by changes to the database structure. If the object you're appending isn't complete (such as when you haven't appended any Field objects to a Fields collection of an Index object before it's appended to an Indexes collection) or if the properties set in one or more subordinate objects are incorrect, using the Append method causes an error. For example, if you haven’t specified a field type and then try to append the Field object to the Fields collection in a TableDef object, using the Append method triggers a run-time error.
Append (Object)
Object: An object variable that represents the field being appended to the collection.
Workspaces.Append Object:=
Count
Returns the number of objects in the specified collection.
Because members of a collection begin with 0, you should always code loops starting with the 0 member and ending with the value of the Count property minus 1. If you want to loop through the members of a collection without checking the Count property, you can use a For Each...Next command. The Count property setting is never Null. If its value is 0, there are no objects in the collection.
Workspaces.Count
Delete
Deletes the specified Workspace form the Workspaces collection.
Delete (Name)
Name: The name of the workspace to delete.
Dim strName As String: strName =
Workspaces.Delete Name:=strName
Item
Item (Item)
Refresh
Not supported for this object.
You can't use the Refresh method with collections that aren't persistent, such as Connections, Databases, Recordsets, Workspaces, or the QueryDefs collection of a Connection object.
Workspaces.Refresh