Determine the folder of open datbase

J

John

I am trying to determine the folder path to the current
open database.

If my db is in c:\data\data.mdb and I run CurrentDb.Name
this will give me c:\data\data.mdb. However I am after
c:\data.
The excel equivalent would be ThisWorkbook.Path.

How is this done from access?

John
 
A

Allen Browne

Access 2000 or above:
Left(dbEngine(0)(0).Name, InstrRev(dbEngine(0)(0).Name, "\")-1)

Access 97 or earlier:
Left(dbEngine(0)(0).Name, Len(dbEngine(0)(0).Name) -
Len(Dir(dbEngine(0)(0).Name))-1)
 
Top