find the filepath of my database (1 Viewer)

Jacob Mathai

Registered User.
Local time
Today, 01:54
Joined
Sep 6, 2001
Messages
546
When I am running an ACCESS database, how can I programatically find the path of the file (data base)?
Any help will be appreciated.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 19:54
Joined
Feb 28, 2001
Messages
27,319
You can get the full file specification in VBA code using

Dim stDBName as String

stDBName =CurrentDB.Name
 

ghudson

Registered User.
Local time
Yesterday, 20:54
Joined
Jun 8, 2002
Messages
6,195
If you want the path to the current database, then use:
Left(CurrentDb.Name,Len(CurrentDb.Name)-Len(Dir(CurrentDb.Name)))

If you want just the name of the current database, then use:
Dir(CurrentDb.Name)

If you want the path and the name of the current database, then use:
CurrentDb.Name

HTH
 

Users who are viewing this thread

Top Bottom