The Name property of the database object holds this information. For example,
typing
?CurrentDB.Name
in the Debug window will return the path and filename of the currently
open database.
To return the directory, use this function.
Function CurrentDBDir() As String
Dim strDBPath As String
Dim strDBFile As String
strDBPath = CurrentDb.Name
strDBFile = Dir(strDBPath)
CurrentDBDir = Left$(strDBPath, Len(strDBPath) - Len(strDBFile))
End Function
To return just the database name, use Dir$
Dir$( CurrentDB.Name )
or
Dir$( strFilePath )
|