My question, or point of discussion if you like, is why is the default Workspace object always described as DBEngine.Worksp aces(0) and not the simpler Workspaces(0) which, according to all I've discovered, is the same thing. Am I missing something important? I couldn't even find a reference that confirmed that the references are the same, although they are both from the DAO library.
I'm looking for a way to determine the actual Workspace object involved when dealing with a Database object. I'm surprised the DAO.Database object doesn't have a simple property pointing to the workspace it's within, but it doesn't. The best I have so far is :
I'm looking for a way to determine the actual Workspace object involved when dealing with a Database object. I'm surprised the DAO.Database object doesn't have a simple property pointing to the workspace it's within, but it doesn't. The best I have so far is :
Code:
'WorkspaceFromDB() returns the Workspace object that contains dbSought.
Public Function WorkspaceFromDB(ByVal dbSought As DAO.Database) As DAO.Workspace
Dim wsVar As DAO.Workspace
Dim dbVar As DAO.Database
For Each wsVar In Workspaces
For Each dbVar In wsVar.Databases
If dbVar Is dbSought Then
Set WorkspaceFromDB = wsVar
Exit Function
End If
Next dbVar
Next wsVar
End Function
Comment