Condividi tramite


Visual Basic Concepts

Attaching Code to ADO Events

ADO exposes a set of events from its Connection and Recordset objects. These events are fired so you can attach code to be executed when something occurs on the object. For example, a MoveComplete event is fired on the Recordset object whenever a record is navigated.

To add code to an ADO Connection or Recordset event

  1. Click View Code in the Data Environment designer toolbar.

    -or-

    Right-click a Connection or Command object and click View Code on the shortcut menu.

  2. Select an object in the left drop-down list and then select an event in the right drop-down list.

  3. Add code in the Code****window, as appropriate.