H
Helge V. Larsen
I have the following VBA that is used to refresh all links to linked tables.
It functions correctly when the database that I link to is closed.
But when it is opened (by me) I get the error message
"The database has been placed in a state by user 'Admin' on machine
'PC-12345' that prevents it from being opened or locked.".
I get the error message most times, but not always. I cannot find out when.
Perhaps something about timeout ?
What can I do to prevent the error ?
Helge
Please also answer directly to Helge.V.Larsen/Remove this/@/and
this/Risoe.DK
Sub Refresh_Links
Dim aTabDef As Object
Dim Cannot_Refresh as Boolean
Cannot_Refresh = False
For Each aTabDef In Application.CurrentDb.TableDefs
If aTabDef.Connect <> "" Then
On Error GoTo Lab_Cannot_Refresh
aTabDef.RefreshLink
On Error GoTo 0
End If
Next aTabDef
Lab_Cannot_Refresh:
Cannot_Refresh = True
' Error trapping code placed here.
End Sub
It functions correctly when the database that I link to is closed.
But when it is opened (by me) I get the error message
"The database has been placed in a state by user 'Admin' on machine
'PC-12345' that prevents it from being opened or locked.".
I get the error message most times, but not always. I cannot find out when.
Perhaps something about timeout ?
What can I do to prevent the error ?
Helge
Please also answer directly to Helge.V.Larsen/Remove this/@/and
this/Risoe.DK
Sub Refresh_Links
Dim aTabDef As Object
Dim Cannot_Refresh as Boolean
Cannot_Refresh = False
For Each aTabDef In Application.CurrentDb.TableDefs
If aTabDef.Connect <> "" Then
On Error GoTo Lab_Cannot_Refresh
aTabDef.RefreshLink
On Error GoTo 0
End If
Next aTabDef
Lab_Cannot_Refresh:
Cannot_Refresh = True
' Error trapping code placed here.
End Sub