
To derive the current directory where your database is located in:
'******************** Code Begin ****************
'Code courtesy of Terry Kreft
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
'******************** Code End ****************
Note: if you have problems with the code, try tweaking the next to last line to read:
CurrentDBDir = left(strDBPath, InStr(strDBPath, strDBFile) - 1)That is how the code originally was written, subsequently it was changed to what it is now when a particular bug was discovered.)