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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
Function ModifAttache(strDBPath)
' Modification simple des attaches
'
' sur le modèle de fGetLinkPath de Dev Ashish
' 21/07/2005
Dim vieuxnom As String, stPath As String
Dim loTd As TableDef
Dim dbs As Database
Dim I, nb As Integer
I = 0
CurrentDb.TableDefs.Refresh
' nb de table
nb = CurrentDb.TableDefs.Count
' barre de progression
' SysCmd acSysCmdInitMeter, "Text à afficher", nb 'Définit le texte à afficher et la valeur maximale de la jauge.
For Each loTd In CurrentDb.TableDefs
On Error Resume Next
stPath = dbs.TableDefs(loTd.Name).Connect
If stPath = Null Then
Else
I = I + 1
' SysCmd acSysCmdUpdateMeter, "Text à afficher", I 'Définit le texte à afficher et la valeur actuelle de la jauge.
vieuxnom = fGetLinkPath(loTd.Name)
loTd.Connect = ";Database=" & strDBPath
' loTd.Connect = ";" & strDBPath
loTd.RefreshLink
Debug.Print loTd.Name; " "; fGetLinkPath(loTd.Name); " à la place de : "; vieuxnom
' bds.TableDefs.Append
End If
Next loTd
Set loTd = Nothing
CurrentDb.TableDefs.Refresh
' SysCmd acSysCmdRemoveMeter 'Supprime la jauge d'avancement
MsgBox "Terminé." & vbCrLf & I & " tables attachées pointent désormais vers la base de données " & strDBPath, vbOKOnly, "Procédure terminée avec succés"
End Function |
Partager