Function to return path to current mdb

M

Mark Andrews

Here ya go:
Function CurrentDBDir() As String

Dim strDB As String, strCurrentDir As String

strDB = CurrentDb.Name
strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB)))

CurrentDBDir = strCurrentDir
End Function

HTH,
 
D

Daniel Pineault

To Determine the Current Database Path, use:
Application.CurrentProject.Path

To Determine Current Database Name without Path, use:
Application.CurrentProject.Name

To Determine Current Database Path and FileName, use:
Application.CurrentDb.Name
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
S

Sky

Here ya go:
Function CurrentDBDir() As String

Dim strDB As String, strCurrentDir As String

strDB = CurrentDb.Name
strCurrentDir = Left(strDB, Len(strDB) - Len(Dir(strDB)))

CurrentDBDir = strCurrentDir
End Function

HTH,

Or: Application.CurrentProject.Path

Steve
 
Top