EVENT:  Recordset::EndOfRecordset

EndOfRecordset (fMoreData, adStatus, pRecordset)

The EndOfRecordset event can be fired when an attempt is made to go past the end of the Recordset. This would occur, for example, if you were already at the end of the Recordset and called the MoveNext method.

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.

While in this event, you could append more records onto the end of the Recordset and then repeat the MoveNext call.

There are three parameters that are passed to this event.

The fMoreData parameter is a Boolean value that if, True, allows the appending of more data to the end of the Recordset.

The adStatus parameter is one of the EventStatusEnum constants that describes the current status of the 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


The pRecordset parameter is the Recordset object to which this event applies.
 
Code (Visual Basic):
' 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_EndOfRecordset( fMoreData As Boolean, _
   adStatus As ADODB.EventStatusEnum, _
   ByVal pRecordset As ADODB.Recordset )

' place any code you desire here, for example
If fMoreData = False Then
   adStatus = adStatusCancel
End If

End Sub

Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information