诸位,我在使用VB外接程序中外接数据向导时,建立好窗体后,单击运行,却出现"编译错误:过程声明与同名事件或过程的描述不匹配."的警告.我真的不知是什么原因请高手予以解释.谢谢!相关代码如下:
Option Explicit
Private Sub Form_Resize()
On Error Resume Next
'当窗体调整时会调整网格
grdDataGrid.Height = Me.ScaleHeight - datPrimaryRS.Height - 30 - picButtons.Height
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
Private Sub datPrimary_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)
'错误处理程序代码置于此处
'想要忽略错误,注释掉下一行
'想要捕获它们,在此添加代码以处理它们
MsgBox "Data error event hit err:" & Description
End Sub
Private Sub datPrimary_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)====错误光标显示处
'为这个 recordset 显示当前记录位置
datPrimary.Caption = "Record: " & CStr(datPrimary.Recordset.AbsolutePosition)
End Sub
Private Sub datPrimary_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
'验证代码置于此处
'下列动作发生时该事件被调用
Dim bCancel As Boolean
Select Case adReason
Case adRsnAddNew
Case adRsnClose
Case adRsnDelete
Case adRsnFirstChange
Case adRsnMove
Case adRsnRequery
Case adRsnResynch
Case adRsnUndoAddNew
Case adRsnUndoDelete
Case adRsnUndoUpdate
Case adRsnUpdate
End Select
If bCancel Then adStatus = adStatusCancel
End Sub
Private Sub cmdAdd_Click()
On Error GoTo AddErr
datPrimary.Recordset.MoveLast
grdDataGrid.SetFocus
SendKeys "{down}"
Exit Sub
AddErr:
MsgBox Err.Description
End Sub
Private Sub cmdDelete_Click()
On Error GoTo DeleteErr
With datPrimary.Recordset
.Delete
.MoveNext
If .EOF Then .MoveLast
End With
Exit Sub
DeleteErr:
MsgBox Err.Description
End Sub
Private Sub cmdRefresh_Click()
'只有多用户应用程序需要
On Error GoTo RefreshErr
datPrimary.Refresh
Exit Sub
RefreshErr:
MsgBox Err.Description
End Sub
Private Sub cmdUpdate_Click()
On Error GoTo UpdateErr
datPrimary.Recordset.UpdateBatch adAffectAll
Exit Sub
UpdateErr:
MsgBox Err.Description
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
[此贴子已经被作者于2005-6-29 22:15:40编辑过] |