Called after all records in an asynchronous operation have been retrieved.
The FetchComplete event is fired after all of the records have been retrieved in an
asynchronous fetch for a client-side Recordset.
An event is simply a subroutine that is automatically called after a specific operation has occurred.
This subroutine can contain any code that you need to run when the event occurs.
The subroutine will only be called if it is included in your code.
For example, you could notify the user that the fetch is completed,
rather than making period status checks using the FetchProgress event.
There are three parameters passed to this event.
EventStatusEnum Constants
Constant | Value | Description |
---|---|---|
adStatusCancel | 4 | Cancels the operation that fired the event |
adStatusCantDeny | 3 | Cannot cancel pending operation |
adStatusErrorsOccurred | 2 | Indicates that warnings and/or errors occurred |
adStatusOK | 1 | The operation that fired the event was successful |
adStatusUnwantedEvent | 5 | The operation that generated the event cannot generate future events |
' Use the WithEvents keyword to designate that events
' can be handled by this Recordset object
Dim WithEvents objRecSet As ADODB.Recordset
' Note how the object name, objRecSet, is incorporated into the event Sub name
Private Sub objRecSet_FetchComplete( ByVal pError As ADODB.Error, _
adStatus As ADODB.EventStatusEnum, _
ByVal pRecordset As ADODB.Recordset )
' place any code you desire here, for example
If adStatus = adStatusErrorsOccurred Then
Dim objError As ADODB.Error
For Each objError in pRecordset.Errors
Debug.Print vbTab objError.Description
Next
End If
End Sub