Rs.RecordCount类型不匹配的问题,如图
是数字1 和Rs.RecordCount,类型不配吗Private Sub 删除货商记录_Click()
On Error GoTo Err_删除货商记录_Click
Dim STemp As String
Dim i As Integer
Dim Rs As ADODB.Recordset
Set Rs = New ADODB.Recordset
STemp = "Select * From 货商资料"
Rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
Rs.MoveFirst
For i = 1 To Rs.RecordCount
If Rs("货商 ID") = Me![货商资料管理 子窗体]![货商 ID] Then
Rs.Delete 1
i = Rs.RecordCount + 1
Else
Rs.MoveNext
End If
Next i
MsgBox "货商资料已经删除完成!", vbOKOnly, "删除完成"
Me![货商资料管理 子窗体].Requery
Set Rs = Nothing
Exit_删除货商记录_Click:
Exit Sub
Err_删除货商记录_Click:
MsgBox Err.Description
Resume Exit_删除货商记录_Click
[ 本帖最后由 ao0330 于 2013-11-20 21:55 编辑 ]