Unanswered: Any method to relink tables using code.
I am having a front end database which is released in different servers and each database is having its own backend.
Front End is same for multiple locations but each server has got their own backend and It takes a hell of time to connect from the front end, If we go via the Database Utilities --> Linked Tables Manager.
Dim tdf As TableDef
Dim newconn As String
newconn = "\\ShareName\FolderName\FileName.mdb"
If Len(newconn) = 0 Then
MsgBox "You haven't selected any database. Table links will not be changed", vbInformation, "No database selection"
On Error GoTo ErrLinks
newconn = ";Database=" & newconn
For Each tdf In CurrentDb.TableDefs
If Len(tdf.Connect) > 0 Then
tdf.Connect = newconn
MsgBox "Tables successfully linked"
Select Case Err.Description
MsgBox "The database " & Right(newconn, Len(newconn) - 10) & " does not contain the " _
& "table '" & tdf.NAME & "'. Please select another database.", vbCritical, "Invalid database"
MsgBox "Error: " & Err.Number & "-" & Err.Description