O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

E.2. Errors Collection and Error Object

The Errors collection contains all Error objects created by a response to a provider-related failure. The Error object contains the details about the error; it also has properties and methods you can use within your code. Any operation that involves an ADO object can generate errors. Every time another error occurs for the same object, an additional Error object is added to the Errors collection.

One caveat of error processing is that when a new ADO operation generates an error, the Errors collection is cleared and a new set of Error objects can be added to the Errors collection. It is common to use error-handling routines to examine the Error objects in the Errors collection to react to possible errors. This allows you to display helpful error messages in plain language rather than relying on the system to generate errors that are incomprehensible to inexperienced users.

E.2.1. Properties of the Errors Collection

The various properties of the Errors collection are summarized in the following table.

PropertyData TypeDescription
CountLongReturns the number of error objects stored in the Errors collection.
ItemString or LongReferences a specific member of the Errors collection by name or ordinal number.

E.2.2. Methods for the Errors Collection

The following table describes the methods available for the Errors collection.

MethodDescription
ClearRemoves all Error objects from the Errors collection.
RefreshUpdates the Errors collection to encompass ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required