Encapsulate ADO errors within ADO event handlers

Encapsulate ADO errors within ADO event handlers

Post by michaelfra » Wed, 28 Jan 2004 01:13:03


I am trying to trap ADO errors within the ADO event handlers and clear
the error, or do my error handling before the event returns control
back to the main program. For example, if I do something like:

rs.delete, where rs is an ado withevents recordset, and there are no
records in the recordset the EndOfRecordset event fires, and allows me
to do some things to the recordset, and finally the MoveComplete event
fires. However, there are no errors that I can find while in the
event, but when it returns to the original call an error gets raised.
The error basically says that the method delete has failed.

I want to take that error and trap the error within the event handler
and do something with it before it returns to the main program. IS
THIS POSSIBLE??? I have been trying everything I know, and nothing
works. Why is this so difficult?