-
Set UserDB = DBEngine.Workspaces(1).OpenDatabase(App.Path + "Users.mdb")
In the above code, I get the error "Item not found in collection." Now, I have used this same code with different databases several times. I have done the exact same with this as I have with the others. And ideas?
-
I would normally make a myWS variable containing the dbengine, then open the database separately.
Also, app.path may not contain a backslash at the end.
i.e.
Code:
dim myWs as Workspace
dim myDb as Database
Set myWs=dbengine.workspaces(0)
Set myDB=myWs.OpenDatabase(app.path & "\Users.mdb")
Try that.
-
Ack!
It was my workspaces(1) instead of 0. How do I make a new workspace?
-
Syntax:
Set workspace = CreateWorkspace(name, user, password, type)
Example:
Code:
Dim wrkODBC as Workspace
Set wrkODBC = CreateWorkspace("ODBCWorkspace", "admin", _
"", dbUseODBC)
Workspaces.Append wrkODBC