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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top