ODBC call failed : Error # 3146

V

vcsphx

All, I have a Access 03 db that pulls data from a SQL server. The code works
just fine but sometimes when the code executes the query that connects to the
server, I guess when the server gets busy, it gives me a "ODBC call failed :
Error # 3146" error. For the ODBC Timout property in the query, I have set it
as "0" but still it's erring out at times. So I built an error handling that
looks something like this:

"...
on error goto ErrorHandler
dim rs as dao.recordset
dim rs1 as dao.recordset
set rs1=db.openrecordset("tblmain",dbopenrecordset)

do while rs1.eof=false
j=0
REDO_ONCE_ON_ERROR:
set rs=db.openrecordset("select * from sql_query_name where
c1='" & rs1!main & ''",dbopendynaset)
do while rs.eof=false
....
loop
NextEventCode:
rs1.movenext
loop

ErrorHandler:

'For a given parameter, the first time this error pops up, then wait for 2
minutes and re-try. If it errs out again, then skip this parameter and goto
the next record in the tblmain.
j = j + 1
If j = 1 and err.number =3146 Then
twait = Time
twait = DateAdd("s", 120, twait)
Do Until tnow >= twait
tnow = Time
Loop
GoTo REDO_ONCE_ON_ERROR
Elseif j>1 and err.number=3146
GoTo NextEventCode
End If

The issue I have here is that the first time I get this error, the ON ERROR
statement works fine. But if I get the same time out error again, then for
some reason the ON ERROR statement gets disabled and the system just breaks.
It spits out the error and I have to go and manually run it again. Do you
guys know why the ERROR HANDLING logic is not working for the first time but
not after that? Thank you very much for your help!
 
V

vcsphx

Hi,

Thank you very much for the article! It did help me to find out what exactly
the error is: "[Microsoft][ODBC SQL Server Driver][SQL Server]Transaction
(Process ID 207) was deadlocked on lock resources with another process and
has been chosen as the deadlock victim. Rerun the transaction." The question
I have now is, as I mentioned earlier, I did have the Error Handling
mechanism that tries to rerun the transaction but this Error handling works
only for the first time. If I run into this same error again for a different
transaction, then the Error Handling I have do not work. Ideas? Very much
appreciated...Thanks!
 
A

Alex Dybenko

Hi,
I think you need to find why this deadlock occurs and avoid it by changing
DB design

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


vcsphx said:
Hi,

Thank you very much for the article! It did help me to find out what
exactly
the error is: "[Microsoft][ODBC SQL Server Driver][SQL Server]Transaction
(Process ID 207) was deadlocked on lock resources with another process and
has been chosen as the deadlock victim. Rerun the transaction." The
question
I have now is, as I mentioned earlier, I did have the Error Handling
mechanism that tries to rerun the transaction but this Error handling
works
only for the first time. If I run into this same error again for a
different
transaction, then the Error Handling I have do not work. Ideas? Very much
appreciated...Thanks!

Alex Dybenko said:
hi,
try to add extended error handling to get specific error message, see:
http://support.microsoft.com/kb/183278

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top