Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime Error 3146: ODBC call failed!!

Status
Not open for further replies.

Imshaad

Programmer
Jun 2, 2003
9
MU
Hi everybody,

Could anybody help me out with this one:

i am currently handling the error in the case where sql server is stopped in the middle of a process

-----
If Err.Number = 3146
While MsgBox("ODBC Failed",, vbRetryCancel)=vbRetry AND check = False
Check
End If
Wend
Resume
----

Function Check verifies whether SQL server is running or not.

However when the sql started and i am able to resume , i am getting the same runtime error when i set a new recordset even if now sql server is running


 
hi again,

just to correct a mistake in the code:

If Err.Number = 3146
While MsgBox("ODBC Failed",, vbRetryCancel)=vbRetry AND check = False
Check
Wend
Resume
End If

 
Make sure you clear the error if all you are doing is opening a recordset. If it's successful, it probably does not clear the err object, so it will retain the last error.

Note: ADO maintains it's own error object.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
1) is Option explicit defined
2) Where is the value of check set in
Code:
While MsgBox("ODBC Failed",, vbRetryCancel)=vbRetry AND [COLOR=red]check[/color] = False


Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top