Handling Errors

ActiveX Data Objects gives us the ability to store a collection of the errors that occur for a connection and to cycle through them at any given point. This information is stored in the Errors collection, which is part of the Connection object. Using a For Each command you can loop through the errors.

This is different from looking at the Err object in Visual Basic, which contains only one error. If a database command that is executed generates multiple database errors, the Errors collection can be looped through.

It is possible that an error might not get added to the Errors collection, but the application does raise an error in Visual Basic. In this case you might just want to stick with the Err object. The errors might not ...

Get Sams Teach Yourself Microsoft® Windows® DNA Programming in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.