Ken said:
I have a database (fairly small, but very important to my business). Each time I change computers I have to manually update the links to the backend using the linked table manager. Is there a way to test for the disk error on opening and then refresh the links. Both files (front-end and back-end) exist on the same directory path in flash memory.
This article provides a general procedure to relink:
http://www.mvps.org/access/tables/tbl0009.htm
But, if the front and back ends are always in the same
directory, you can just grab the front end's path from
CurrentProject.Path (or parse it out of CurrentDb.Name in
older versions) and simply set each linked table's Connect
property:
Dim db As Database
Dim tdf As TableDef
Dim strPath As String
strPath = CurrentProject.Path
Set db = CurrentDb()
For Each tdf In db.TableDefs
If tdf.Connect <> "" Then
tdf.Connect = ";DATABASE=" & strPath & "\datafile.MDB"
tdf.RefreshLink
End If
Next tdf
Set tdf = Nothing
Set db = Nothing