How can I get the db's file path at runtime?

gellerche

Registered User.
Local time
Today, 17:13
Joined
Jun 19, 2001
Messages
73
In my VBA, I need to refer to the file path (actually the .ldb file that goes with it) the database is currently in. Is there a way to get the code to generate the path instead of typing, for example:
strLDB = "D:\DATA\My Documents\dbname.ldb"?

Thank you,


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

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

Or if you want the path to the current database, then use:
Left(CurrentDb.Name,Len(CurrentDb.Name)-Len(Dir(CurrentDb.Name)))

HTH
 
Thanks, ghudson. I'll let you know how it works.
 

Users who are viewing this thread

Back
Top Bottom