1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
Function RetablirLiaisons(ByVal strNouveauChemin As String) As Boolean
Dim db As DAO.Database
Dim tdf As DAO.TableDef
' Vérifier que la base dorsale existe
If Dir(strNouveauChemin) = "" Then
MsgBox "La base '" & strNouveauChemin & "' n'existe pas.", vbExclamation, "Assistant Liaisons"
RetablirLiaisons = False
Exit Function
End If
Set db = CurrentDb()
For Each tdf In db.TableDefs
If (tdf.Attributes And dbSystemObject) = 0 Then
If tdf.Connect <> "" Then
tdf.Connect = ";DATABASE=" & strNouveauChemin
tdf.RefreshLink
End If
End If
Next
Set db = Nothing
Set tdf = Nothing
RetablirLiaisons = True
End Function |