Access
Get Back End database location
- Details
- Category: Split Database Split Database
- Last Updated: 13 September 2020 13 September 2020
When working with a split database, you might need to find the location of the backend.
The following code allows you to retrieve the location of the back end from the linked table. You simply 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}