The RecordsetEvent Family
The RecordsetEvent family contains a group of events that belong to the Recordset object. To instantiate a Recordset object that implements events, declare it as follows:
Private WithEvents rst As ADODB.Recordset
As stated earlier, the events within the Recordset family can be broken into five categories:
Field Change events
Record Change events
Recordset Change events
Each category of events contains events pertaining to one specific task. The first of these tasks is retrieving records from a data source.
Two events belong to the Retrieval events category of the RecordsetEvent family:
The FetchProgress event is raised to indicate the progress of a lengthy asynchronous fetch operation.
The FetchComplete event is raised when an asynchronous fetch operation is complete.
So that we can track how ADO raises these two events, add the
PrintStatus method call to each, as shown in the following code. In
addition, we will put an
End keyword within the
FetchComplete event so that the application will terminate once all
of the records have been fetched:
Private Sub rst_FetchProgress(ByVal Progress As Long, _ ByVal MaxProgress As Long, _ adStatus As ADODB.EventStatusEnum, _ ByVal pRecordset As ADODB.Recordset) PrintStatus "FetchProgress", adStatus End Sub Private Sub rst_FetchComplete(ByVal pError As ADODB.Error, _ adStatus As ADODB.EventStatusEnum, _ ByVal pRecordset As ADODB.Recordset) PrintStatus "FetchComplete", adStatus ...