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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different error messages

Status
Not open for further replies.

catdesign

Programmer
Jul 19, 2000
9
0
0
GB
When I used VB6 with DAO to talk to Access97 I was able to respond to 'Cant Update Record locked' messages by trapping error 3186
Now I am using ADO with Access2002 backend, 3186 is not trapped and the error comes up as -2147217887 but with the same error message "cant update, record is locked" (or very similar).

From looking at a Microsoft Information Sheet, it says that -2147217887 is "errors occurred".

Can I not trap specific Jet Locking Errors any more??

 
I should have looked more carefully before asking this question - sorry!

However I have now discovered the ADO error object and whilst NativeError and Number properties are strange, I notice that the SQLState property matches some of the Jet Errors I used to use. eg.

errorhandler:
Dim errado As ADODB.Error
Dim stree As String
For Each errado In mydb.Errors
stree = errado.SQLState
MsgBox stree
Next

This returns 3044 when I try to create a connection to non existant datasource (not a valid path)



I am worried by a statement in a Microsoft Press book which says that "Error handling with ADO is a difficult topic because some error messages are meaningless, confusing, or just plain wrong."

Could I assume that I might get 3186 for a locked record using the SQLstate property if I use a Jet4.0 datasource.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top