Get Back End database location

When  working with a split database, you might need to find the location of the backend.

The following code allows you to retreive the location of the back end from the linked table. You simple pass the name of a linked table and it will return  the back end's path.

{codecitation class="engine parameters" width="" }

Option Compare Database

Option Explicit   

Public Function fHTC_GetBEFolder(pTableName As String) As String
'
' usage example: fHTC_GetBEFolder("Suppliers")
'
Dim strFullPath As String
Dim I As Long

strFullPath = Mid(DBEngine.Workspaces(0).Databases(0).TableDefs(pTableName).Connect, 11)

For I = Len(strFullPath) To 1 Step -1

      If Mid(strFullPath, I, 1) = "\" Then
           fHTC_GetBEFolder = Left(strFullPath, I)

          Exit For

     End If


Next

End Function



Public Function fHTC_GetBEName(pTableName As String) As String
'
' usage example: fHTC_GetBEName("Suppliers")
'

Dim strFullPath As String
Dim I As Long

strFullPath = Mid(DBEngine.Workspaces(0).Databases(0).TableDefs(pTableName).Connect, 11)

For I = Len(strFullPath) To 1 Step -1

     If Mid(strFullPath, I, 1) = "\" Then

          fHTC_GetBEName = Mid(strFullPath, I + 1)
          Exit For

     End If

Next

End Function


Public Function fHTC_GetBEFullPath(pTableName As String) As String
'
' usage example: fHTC_GetBEFullPath("Suppliers")
'
fHTC_GetBEFullPath = Mid(DBEngine.Workspaces(0).Databases(0).TableDefs(pTableName).Connect, 11)

End Function

{/codecitation}