I have copied from this forum a function called RefreshLinks. It should relink the tables
in the path "C:\be\be.mdb ". I have made a button on the form and on the OnClick event
i have put the following
RereshLinks( "C:\be\be.mdb "
However nothing happens.If i deliberately delete the links in the database, then
after pressing the button the tables in the back end database with a path ( "C:\be\be.mdb "
nature of the function, or i do not use it properly. May i receive some information as to how should i use this function ?
The function i have copied and pasted from the Forum is the following :
Function refreshlinks(strFileName As String) As Boolean
Dim tdf As DAO.TableDef
On Error Resume Next
' Loop through all tables in database.
For Each tdf In CurrentDb.TableDefs
' If the Connect property is non-empty, the table is linked
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & strFileName
Err.Clear
tdf.RefreshLink ' Re-link the table.
If Err Then
refreshlinks = False
Exit Function
End If
End If
Next tdf
Set tdf = Nothing
refreshlinks = True ' All links have been refreshed.
End Function