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
|
Private Sub cmdOK_click()
On Error GoTo er
Dim Tabl As DAO.TableDef
Dim NewPath As String
NewPath = Me.txtNewPath
For Each Tabl In CurrentDb.TableDefs
If Tabl.Connect <> "" Then
Tabl.Connect = ";DATABASE=" & NewPath
Tabl.RefreshLink
End If
Next
MsgBox "All linked tables have been successfully refreshed."
DoCmd.Close
DoCmd.OpenForm "MainForm"
Exit Sub
er:
If Err.Number = 3044 Or Err.Number = 3024 Then
MsgBox "File not found.", vbCritical
ElseIf Err.Number = 3011 Then 'if a table is missing
MsgBox "Table " & Tabl.name & " is missing. The installation failed.", vbCritical
Else
MsgBox "Error " & Err.Number & ": " & Err.Description
End If
End Sub |
Partager