Hi all,
(WinXP Pro SP2, Access 2003)
I'm using Dev Ashish's fRefreshLinks function from AccessWeb
(http://www.mvps.org/access/tables/tbl0009.htm) to relink tables in my
front end to one of several back end files.
When I first dropped in the function I was getting an error on one of
my tables saying "Couldn't relink table, table doesn't exist"... or
something similar, for one of my tables. Of course, this wasn't the
case, the table exists, and in fact could be relinked using the Linked
Table Manager in Access. After a few hours of confusion, I deleted the
linked table, reimported it, then reran Dev Ashish's code. This worked,
and the function, continues to work at this time.
My question: any thoughts on why this happened and what can be done to
prevent it in the future.
Within the fRefreshLinks function, this is where the error originates:
If fIsRemoteTable(dbLink, strTbl) Then
'everything's ok, reconnect
Set tdfLocal = dbCurr.TableDefs(strTbl)
With tdfLocal
.Connect = ";Database=" & strDBPath
.RefreshLink
collTbls.Remove (.Name)
End With
Else
Err.Raise cERR_NOREMOTETABLE
End If
End If
fIsRemoteTable(dbLink, strTbl) takes you to the following:
Function fIsRemoteTable(dbRemote As Database, strTbl As String) As
Boolean
Dim tdf As TableDef
On Error Resume Next
Set tdf = dbRemote.TableDefs(strTbl)
fIsRemoteTable = (Err = 0)
Set tdf = Nothing
End Function
Which returns False, thus putting you back into Err.Raise
cERR_NOREMOTETABLE, and thusly the error.
Now to be perfectly clear, I don't completely understand all of the
code in the functions, although I have the Access 2002 Developer's
Handbook and I'm attempting to figure it all out :D.
Anyhow, any thoughts would be greatly appreciated on why this happened
and how to prevent it from happening in the future would be
appreciated.
Best,
Kelii