Помогите с ошибкой в программе
Ребята, написал программу, появляется ошибка компиляции: Procedure declaration does not match description of event or procedure having the same name.
Пожалуйста подскажите в чем ошибка, вот текст программы:
Option Explicit
Private Sub ado_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If pRecordset.BOF Or pRecordset.EOF Then
cmdDelete.Enabled = False
cmdEdit.Enabled = False
Else
cmdDelete.Enabled = True
cmdEdit.Enabled = True
End If
End Sub
Private Sub cmdAdd_Click()
ado.Recordset.AddNew
Set frmAccounting.ado = ado
frmAccounting.Caption = "Добавление оборудования"
frmAccounting.Show vbModal, frmMain
End Sub
Private Sub cmdEdit_Click()
If ado.Recordset.BOF Or ado.Recordset.EOF Then Exit Sub
Set frmAccounting.ado = ado
frmAccounting.Caption = "Изменение оборудования"
frmAccounting.Show vbModal, frmMain
End Sub
Private Sub cmdDelete_Click()
If ado.Recordset.BOF Or ado.Recordset.EOF Then Exit Sub
If MsgBox("Вы действительно хотите удалить запись?", vbInformation Or vbYesNo) = vbYes Then
ado.Recordset.Delete adAffectCurrent
ado.Recordset.MoveNext
End If
End Sub
Private Sub cmdFind_Click()
Dim Field As Field, Criteria As String
If cmbFindField.ListIndex > -1 Then
Set Field = ado.Recordset(cmbFindField.ListIndex)
If Field.Type = adVarWChar Then
Criteria = Field.Name & " LIKE '*" & txtFind.Text & "*'"
ElseIf Field.Type = adDate And IsDate(txtFind.Text) Then
Criteria = Field.Name & " = #" & Format(CDate(txtFind.Text), "mm/dd/yyyy") & "#"
ElseIf Field.Type = adInteger And IsNumeric(txtFind.Text) Then
Criteria = Field.Name & " = " & txtFind.Text
Else
Exit Sub
End If
ado.Recordset.Find Criteria, , adSearchForward, adBookmarkFirst
End If
End Sub
Private Sub Form_Load()
ado.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;Persist Security Info=False"
ado.RecordSource = "Accounting"
ado.Refresh
cmbFindField.ListIndex = 0
End Sub
Private Sub Form_Resize()
DataGrid1.Width = Me.ScaleWidth - DataGrid1.Left - 8
DataGrid1.Height = Me.ScaleHeight - DataGrid1.Top - 8
End Sub
Ошибка появляется на строке Private Sub ado_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset).
Заранее спасибо!
Цитата:
Procedure declaration does not match description of event or procedure having the same name.
Код:
Private Sub ado_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset).
Index должно быть пустое поле
Вот, что ждет вас дальше, но это другая Тема