
Changing the linked table path without the linked table manager
Hi Jan
Two things.
1. Alias your database. Avoids some hassles (some that you're experiencing -
possibly unwittingly) and is good practice. CurrentDB refreshes every object
every time it's called. You need to get a handle on the object - do not get
a new handle each time with "dbCurrent.TableDefs(Td.Name)", or
CurrentDB.TableDefs(Td.Name)", etc
Dim dbCurrent As Database
Set dbCurrent = CurrentDB()
2. Modify code as follows (If you already have the handle to Td why not use
it?).
For Each Td In dbCurrent.TableDefs()
If Td.Connect <> "" Then
Td.Name.Connect = ";DATABASE=C:\db2.mdb"
Td.Refresh ' ** This causes link property to be updated.
End If
Next
--
Graeme Richardson
Analyst Programmer
AdeptX Limited