Refresh Table Links

B

Brad

Thanks for taking the time to read my question.

I am deleting a table link, and then adding a new table
link (to a different table). (all variables are defined
in my code)

I am using the following to get the table info (file
name, and location)

- - - - - - - - - - - - - - - - - - - - - - -

With DBEngine(0)(0).TableDefs("LNULinkedExport")
LinkedFileInfoPath = .Connect
LinkedFileInfoFileName = .SourceTableName
End With

x = 9
y = 1
z = Len(LinkedFileInfoPath)

Do Until Part = "DATABASE="
If x = 9 Then
Part = Left(LinkedFileInfoPath, x)
x = x + 1
Else
Part = Right(Left(LinkedFileInfoPath, x), 9)
x = x + 1
y = y + 1
End If
Loop

LinkedFileInfoPath = Right(LinkedFileInfoPath, z - (y +
8))

LinkedFileInfo = LinkedFileInfoPath & "\" &
LinkedFileInfoFileName

- - - - - - - - - - - - - - - - - - - - -

When the code runs through this part, it returns the info
on the old linked table

LinkedFileInfo should be something
like "C:\NewFolder\NewFileName.txt"

Instead I get "C:\OldFolder\OldFileName.txt"

I need the info on the new linked table, so I thought I'd
try the following.

Set dbs = CurrentDb
Set tdf = dbs.TableDefs("LNULinkedExport")
tdf.RefreshLink

After the code above, I still get the old table info.

How do I get the new table info?

Thanks again,

Brad
 
Top