PRB: ADO Data Control Events May Generate a Compilation Error (222145)
The information in this article applies to:
- ActiveX Data Objects (ADO) 2.1
- ActiveX Data Objects (ADO) 2.5
- ActiveX Data Objects (ADO) 2.6
- ActiveX Data Objects (ADO) 2.7
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q222145 SYMPTOMS
If you are using the ADO Data Control events in a Visual Basic 6.0 project and you reference ADO 2.1 or later, the following compile error occurs:
Compile Error:
Procedure declaration does not match description of event or procedure having the same name.
The following ADO Data Control Events generate the error if used:
EndOfRecordset
FieldChangeComplete
MoveComplete
RecordChangeComplete
RecordsetChangeComplete
WillChangeField
WillChangeRecord
WillChangeRecordset
WillMove
The above events all use the ADODB.Recordset parameter within the declaration.
For example: The ADO Data Control event WillMove declaration is:
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset
NOTE: If no ADO Data Control events are used in the project, no errors will occur.
CAUSE
The interfaces in ADO 2.1 and later have been changed from ADO 2.0. There is no issue with interface changes unless a control is compiled using an older version of ADO. This is the case with the ADO data control. See the "More Information" section for details.
RESOLUTION
To make the ADO Data Control events work with ADO 2.1 or later, the declaration of the event has to be changed to include:
ADODB.Recordset20
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset20)
Please note that the "20" that has been added to ADODB.Recordset in the pRecordset argument.
STATUS
This behavior is by design.
REFERENCESFor additional information, click the article number below
to view the article in the Microsoft Knowledge Base:
257714 FIX: ADO DataControl and DataEnvironment Events Only Work with ADO 2.0
Modification Type: | Major | Last Reviewed: | 8/23/2001 |
---|
Keywords: | kbCtrl kbDatabase kbDataBinding kbDSupport kbprb KB222145 |
---|
|