David-W-Fenton wrote:
Karl Donaubauer wrote
Set db =
DBEngine.Workspaces(0).OpenDatabase("c:\path\Another.mdb")
Just curious, but is there a difference between that and
DBEngine.OpenDatabase()? I would assume the shorter version is going
to use the default workspace, and have never used anything else.
Yes, you're right.
I have used all 3 ways (also simply OpenDatabase()) depending on
the mood or where I copied the line from ;-) (this time from my website).
A short test proves that even setting the db immediately
after appending a new workspace:
...
Set wrkJet = CreateWorkspace("mySpace", "admin", "")
DBEngine.Workspaces.Append wrkJet
Set db = DBEngine.OpenDatabase("Some.mdb")
or
Set db = OpenDatabase("Some.mdb")
a loop through the databases collections shows that
the default workspace is used.
A different workspace is only used when stated explicitely:
Set db = DBEngine.Workspaces(1).OpenDatabase("Some.mdb")
or
Set db = Workspaces("mySpace").OpenDatabase("Some.mdb")
etc.
So there's no need to do more than
Set db = OpenDatabase()
cu
Karl
*******
Access-FAQ (German/Italian): http://www.donkarl.com