
Current database path name
This is defined in a main module:
Set gdbCurrent = dbengine.workspaces(0).Databases(0)
gstrPath = gstrDatabasePath()
--------------------------------------------------------------------------
This will get the path of the database
Function gstrDatabasePath ()
On Error GoTo gstrDatabasePathError
'Declare local variables
Dim intPosition As Integer
Dim strDBPath As String
Dim strCurrentDB As String
'Parse the database Name
intPosition = 0
intPosition = InStr(1, gdbCurrent.Name, "\")
strDBPath = gdbCurrent.Name
strCurrentDB = gdbCurrent.Name
Do While intPosition > 0
intPosition = InStr(1, strCurrentDB, "\")
strCurrentDB = Right(strCurrentDB, Len(strCurrentDB) -
intPosition)
Loop
'Return the Name of the database
strDBPath = Left(strDBPath, (Len(strDBPath) - Len(strCurrentDB))
- 1)
gstrDatabasePath = strDBPath
gstrDatabasePathExit:
'Exit the procedure
Exit Function
gstrDatabasePathError:
'Display the error
MsgBox "gstrDatabasePath() Error " + Str(Err) + " Line " +
Str(Erl) + ": " + Error$
Resume gstrDatabasePathExit
End Function
--------------------------------------------------------------------------
This will get the database name
Function gstrDatabaseName ()
On Error GoTo gstrDatabaseNameError
'Declare local variables
Dim intPosition As Integer
Dim strCurrentDB As String
'Parse the database Name
intPosition = 0
intPosition = InStr(1, gdbCurrent.Name, "\")
strCurrentDB = gdbCurrent.Name
Do While intPosition > 0
intPosition = InStr(1, strCurrentDB, "\")
strCurrentDB = Right(strCurrentDB, Len(strCurrentDB) -
intPosition)
Loop
'Return the Name of the database
gstrDatabaseName = strCurrentDB
gstrDatabaseNameExit:
'Exit the procedure
Exit Function
gstrDatabaseNameError:
'Display the error
MsgBox "gstrDatabaseName() Error " + Str(Err) + " Line " +
Str(Erl) + ": " + Error$
Resume gstrDatabaseNameExit
End Function