Public Function fg_binde_local_Path()
'----------------<
fg_binde_local_Path() >----------------
'< init
>
Dim sCurrentPath As String
sCurrentPath = CurrentProject.Path
'</
init >
'<
setup >
Dim IsTest9008 As Boolean
If sCurrentPath Like "*9008*" Then
IsTest9008 = True
Else
IsTest9008 = False
End If
Dim sPath_Group As String
If IsTest9008 Then
sPath_Group = "H:\Excel\Berichtswesen\Datenbanken\Group\Test9008"
Else
sPath_Group = "H:\Excel\Berichtswesen\Datenbanken\Group"
End If
'</
setup >
Dim tbl As TableDef
'---------<
@Loop: Tables >----------
For Each tbl In CurrentDb.TableDefs
Dim sConnection As String
sConnection = tbl.Connect
'------<
check linked table >------
If sConnection Like "*DATABASE=*" Then
'----< Is Linked Table >----
'*1:
;DATABASE=H:\Excel\Berichtswesen\Datenbanken\xx\Test9008\Data.mdb
'*2:
;DATABASE=H:\Excel\Berichtswesen\Datenbanken\Group\Group_Data.mdb
'--< get Path >--
Dim intPos_Start As Integer
intPos_Start = Len(";DATABASE=") + 1
Dim intPos_End As Integer
intPos_End =
InStrRev(sConnection, "\")
Dim sDatabase As String
sDatabase = Mid$(sConnection,
intPos_End + 1)
'--</ get Path >--
Dim sTablename As String
sTablename = tbl.SourceTableName
'< bind new >
If sConnection Like "*Group*" Then
tbl.Connect = ";DATABASE=" & sPath_Group & "\" & sDatabase
Else
tbl.Connect = ";DATABASE=" & sCurrentPath & "\" & sDatabase
End If
'</ bind new >
'<
rebind >
tbl.RefreshLink
'</
rebind >
'----</ Is Linked Table >----
End If
'------</
check linked table >------
Next
'----------</
@Loop: Tables >----------
'Abschluss
MsgBox "FERTIG"
'----------------</
fg_binde_local_Path() >----------------
End Function
|