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
 

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