M
Maury Markowitz
I have a table that mirrors a table in an external data source - it is
a duplicate in every way. Every day we run a script to compare the
local copy with the external, and that way we find changes between the
two. When these changes are handled, we update the local copy.
One of the updates is deleting rows. Somewhere in my code I'm locking
the local table and deletes most often fail. I have looked everywhere
trying to find the lock, but so far I've failed. Instead, I've decided
to simply write down a notice in a little scratch table, so the user
can go back and manually delete it later (which, oddly, never fails).
So I simply wrapped the DELETE in an On Error, and added a handler.
But what I'm finding is that in most cases, the On Error does not
fire! Instead, the timeout fails, and a dialog comes up asking you if
you want to debug. Can anyone offer any insight here? No, there are no
other error handlers in this procedure. Is it the Goto 0?
Here's my code...
Set rstSource = db.OpenRecordset("qryCashChange", dbOpenSnapshot,
dbReadOnly)
While rstSource.EOF = False
If Not IsNull(rstSource!postNum) Then
Set rstCashCache = New ADODB.Recordset
On Error GoTo GOTTIMEOUT
rstCashCache.Open "DELETE FROM tblmatch WHERE postnum=" &
rstSource!postNum, cnn, adOpenStatic, adLockReadOnly
On Error GoTo 0
GoTo DIDNOTGETTIMEOUT
GOTTIMEOUT:
Call WriteWarning("PAM Import", "Timed out while trying to delete
postnum " & rstSource!postNum & " from tblpammatch. Do it manually.")
DIDNOTGETTIMEOUT:
End If
rstSource.MoveNext
Wend
a duplicate in every way. Every day we run a script to compare the
local copy with the external, and that way we find changes between the
two. When these changes are handled, we update the local copy.
One of the updates is deleting rows. Somewhere in my code I'm locking
the local table and deletes most often fail. I have looked everywhere
trying to find the lock, but so far I've failed. Instead, I've decided
to simply write down a notice in a little scratch table, so the user
can go back and manually delete it later (which, oddly, never fails).
So I simply wrapped the DELETE in an On Error, and added a handler.
But what I'm finding is that in most cases, the On Error does not
fire! Instead, the timeout fails, and a dialog comes up asking you if
you want to debug. Can anyone offer any insight here? No, there are no
other error handlers in this procedure. Is it the Goto 0?
Here's my code...
Set rstSource = db.OpenRecordset("qryCashChange", dbOpenSnapshot,
dbReadOnly)
While rstSource.EOF = False
If Not IsNull(rstSource!postNum) Then
Set rstCashCache = New ADODB.Recordset
On Error GoTo GOTTIMEOUT
rstCashCache.Open "DELETE FROM tblmatch WHERE postnum=" &
rstSource!postNum, cnn, adOpenStatic, adLockReadOnly
On Error GoTo 0
GoTo DIDNOTGETTIMEOUT
GOTTIMEOUT:
Call WriteWarning("PAM Import", "Timed out while trying to delete
postnum " & rstSource!postNum & " from tblpammatch. Do it manually.")
DIDNOTGETTIMEOUT:
End If
rstSource.MoveNext
Wend