tacieslik
Registered User.
- Local time
- Today, 21:56
- Joined
- May 2, 2001
- Messages
- 244
Wow! New forum decor, not been here for a while. 
I have the following code which I'm hoping will allow me to update a linked table to the path stored in a table:
I get some red highlighted typo errors for lines 16 & 23 (If statements). I think it's due to the code '<' and '>'. I don't know if this is correct or not as I've just found most of the code in another thread (old thread). All I've added is the table lookup code at the top.
Thanks in advance.
I have the following code which I'm hoping will allow me to update a linked table to the path stored in a table:
Code:
Option Compare Database
Function relink()
Dim dbs As Database
Dim tdf As TableDef
Dim strFileName As Path
strFilePath = DLookup("fldValue", "tblAdmin", "[fldItemName]='Host1Path'")
' Loop through all tables in the database.
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
' If the table has a connect string, it's a linked table.
If Len(tdf.Connect) > 0 Then
tdf.Connect = ";DATABASE=" & strFileName
Err = 0
On Error Resume Next
tdf.RefreshLink ' Relink the table. _
' If Error occurs HERE, on this line, -produces- <> 0
If Err <> 0 Then
RefreshLinks = False
Exit Function
End If
End If
Next tdf
RefreshLinks = True ' Relinking complete.
End Function
I get some red highlighted typo errors for lines 16 & 23 (If statements). I think it's due to the code '<' and '>'. I don't know if this is correct or not as I've just found most of the code in another thread (old thread). All I've added is the table lookup code at the top.
Thanks in advance.