N
Neil Jordan
I am using Access 2003 on a SBS 2003 server. On my main menu form, I have a
routine to run through a number of SQL linked tables and refresh the link.
When more than one person at a time loads the database, the code seems to
cause these two errors. I have put in an On Error statement so that for
some errors, it will wait a few seconds and try again, but it still gives me
a run time error for these two.
It seems to do it on the tdf.RefreshLink line.
Has anyone got any ideas please??????
On Error GoTo Form_Open_Link_Err
StartOfLinking:
Const Tablecount = 16
Echo True, "Updating Links to Great Plains: 1 of " & Tablecount
Set dbs = CurrentDb
Set tdf = dbs.TableDefs("dbo_RM00101")
tdf.Connect = ConnectString
tdf.RefreshLink
'Open the first recordset to see if it speeds things up:
http://www.granite.ab.ca/access/performancefaq.htm
Set rst = dbs.OpenRecordset("select * from dbo_rm00101", dbReadOnly)
Echo True, "Updating Links to Great Plains: 2 of " & Tablecount
Set tdf = dbs.TableDefs("dbo_PM00200")
tdf.Connect = ConnectString
tdf.RefreshLink
Echo True, "Updating Links to Great Plains: 3 of " & Tablecount
Set tdf = dbs.TableDefs("dbo_RM00103")
tdf.Connect = ConnectString
tdf.RefreshLink
.... etc
Form_Open_Link_Err:
'Linking error when two people try the link refresh at the same time.
'If this occurs, wait random time 2 - 5 seconds then retry
waitseconds = Int((5 * Rnd) + 2)
Echo True, "Waiting " & waitseconds & " seconds for retry..."
StartTime = Timer
While Timer < StartTime + waitseconds
Wend
GoTo StartOfLinking
Resume
routine to run through a number of SQL linked tables and refresh the link.
When more than one person at a time loads the database, the code seems to
cause these two errors. I have put in an On Error statement so that for
some errors, it will wait a few seconds and try again, but it still gives me
a run time error for these two.
It seems to do it on the tdf.RefreshLink line.
Has anyone got any ideas please??????
On Error GoTo Form_Open_Link_Err
StartOfLinking:
Const Tablecount = 16
Echo True, "Updating Links to Great Plains: 1 of " & Tablecount
Set dbs = CurrentDb
Set tdf = dbs.TableDefs("dbo_RM00101")
tdf.Connect = ConnectString
tdf.RefreshLink
'Open the first recordset to see if it speeds things up:
http://www.granite.ab.ca/access/performancefaq.htm
Set rst = dbs.OpenRecordset("select * from dbo_rm00101", dbReadOnly)
Echo True, "Updating Links to Great Plains: 2 of " & Tablecount
Set tdf = dbs.TableDefs("dbo_PM00200")
tdf.Connect = ConnectString
tdf.RefreshLink
Echo True, "Updating Links to Great Plains: 3 of " & Tablecount
Set tdf = dbs.TableDefs("dbo_RM00103")
tdf.Connect = ConnectString
tdf.RefreshLink
.... etc
Form_Open_Link_Err:
'Linking error when two people try the link refresh at the same time.
'If this occurs, wait random time 2 - 5 seconds then retry
waitseconds = Int((5 * Rnd) + 2)
Echo True, "Waiting " & waitseconds & " seconds for retry..."
StartTime = Timer
While Timer < StartTime + waitseconds
Wend
GoTo StartOfLinking
Resume