ADO FetchProgress Event

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO FetchProgress Event

The FetchProgress event is triggered periodically in an asynchronous operation, to state how many more records that have been fetched into the Recordset.

An event is simply a subroutine that can be called automatically 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.

There are four parameters passed to this event.

Syntax

FetchProgress progress,maxprogress,status,objRs

 
Parameter

Description

progress The number of records that have been fetched by the operation
maxprogress The maximum number of records that are expected to be fetched
status An EventStatusEnum value that indicates the status of the execution of the event
objRs The name of the Recordset object that triggered this event

Example


'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_FetchProgress( Progress As Long, _
   MaxProgress As Long, _
   adStatus As ADODB.EventStatusEnum, _
   ByVal pRecordset As ADODB.Recordset )

'place any code you desire here, for example
Print "Records retrieved = " & Progress

End Sub

EventStatusEnum Values

Constant Value

Description

adStatusOK 1 The operation that caused the event was successful
adStatusErrorsOccurred 2 The operation that caused the event failed
adStatusCantDeny 3 The operation that caused the event cannot be cancelled
adStatusCancel 4 The operation that caused the event is cancelled
adStatusUnwantedEvent 5 Prevents subsequent notifications before the event method has finished executing