Article ID: 192645
Article Last Modified on 3/2/2005
Sub main()
Dim myADOEvents As New ADOEvents
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Set myADOEvents.rsEvent = rs
cn.Provider = "sqloledb"
cn.Open "Data Source=<your server name>;Initial Catalog=pubs;", "sa", ""
'rs.open does not fire the RecordsetChangeComplete which it should.
rs.Open "Select * from authors", cn, adOpenForwardOnly, _
adLockReadOnly
'Uncomment the next line to fire the RecordsetChangeEvent
'rs.MoveFirst
DoEvents
Stop
'Does fire the RecordsetChangeEvent, which is expected.
rs.Close
DoEvents
End Sub
Public WithEvents rsEvent As ADODB.Recordset
Private Sub rsEvent_RecordsetChangeComplete(ByVal adReason As
ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As
ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
Debug.Print "RecordsetChangeComplete"
End Sub
Keywords: kbbug kbdatabase kbpending KB192645