'*************************************** ' Code to create Microsoft Jet and ' ODBCDirect Workspaces, and print their ' names. '*************************************** Public Sub CreateWorkspaces() Dim wsJet As DAO.Workspace Dim wsODBC As DAO.Workspace 'Create a new Microsoft Jet workspace Set wsJet = DBEngine.CreateWorkspace( _ "myJetWS", strUserName, strPassword, dbUseJet) 'Create a new ODBCDirect workspace Set wsODBC = DBEngine.CreateWorkspace( _ "myODBCWS", strUserName, strPassword, dbUseODBC) 'Append the workspaces to the collection Workspaces.Append wsJet Workspaces.Append wsODBC 'Print the names of all the workspaces Debug.Print "wsJet.Name: " & wsJet.Name 'myJetWS Debug.Print "wsODBC.Name: " & wsODBC.Name 'myODBCWS 'Clean up wsODBC.Close wsJet.Close Set wsODBC = Nothing Set wsJet = Nothing End Sub