Hi John,
Private Function GetDBDir() As String
' Purpose:
' Gets the directory of the currently open database.
' Based on code originally from Mike Gunderloy.
'
' From Access 97 Developer's Handbook
' by Litwin, Getz and Gilbert. (Sybex)
' Copyright 1997. All Rights Reserved.
'
' In:
' None
' Out:
' Return Value - The name of the directory as a string
' History:
' Created 09/13/94 pel; Last Modified 12/20/95 pel
On Error GoTo GetDBDirErr
Dim dbCurrent As Database
Dim strDbName As String
Dim strProcName As String
strProcName = "GetDBDir"
Set dbCurrent = CurrentDb
strDbName = dbCurrent.Name
Do While Right$(strDbName, 1) <> "\"
strDbName = Left$(strDbName, Len(strDbName) - 1)
Loop
GetDBDir = UCase$(strDbName)
GetDBDirDone:
On Error GoTo 0
Exit Function
GetDBDirErr:
Select Case Err
Case Else
MsgBox "Error#" & Err.Number & ": " & Err.Description, _
vbOKOnly + vbCritical, strProcName
Resume GetDBDirDone
End Select
End Function
If you don't already have it, I recommend getting The Access [yourversion]
Developer's Handbook by Ken Getz et alia.
HTH