Introduction to Events

There are two different types of events:

Will event

Raised when an operation will occur. For instance, the WillConnect event is raised when a connection to a data source will occur. All Will events begin with the word Will.

Complete event

Raised once the operation is completed (successfully or not). An example of a Complete event is the ConnectComplete event that is raised once a connection to a data source has been attempted. Some, but not all, Complete events end with the word Complete.

All Will events have a matching Complete event, but the opposite is not true. Matching Will and Complete events (e.g., WillConnect and ConnectComplete) are usually referred to as “Will/Connect pairs.” Those Complete events that do not have a corresponding Will event are usually referred to as “Standalone events.”

Events belong to either the ConnectionEvent family or the RecordsetEvent family, each of which represents the events that are raised by operations on the respective object.

Within the ConnectionEvent family, there are nine events broken into four categories, as shown in Table 8-1.

Table 8-1. The ConnectionEvent Family of Events

Event Group

Event

Description

Connection Events

WillConnect

Indicates that a connection will occur.

 

ConnectComplete

Indicates that a connection has occurred.

 

Disconnect

Indicates that a connection has ended.

Execution Events

WillExecute

Indicates that an execution will occur.

 

ExecuteComplete

Indicates that an execution has occurred. ...

Get ADO: ActiveX Data Objects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.