|
运行后,系统提示SQL语句出错,请大家帮忙看看是哪里出错?
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 = "selcet * from khdwzl"
rs.Open STemp, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs.MoveFirst
For i = 1 To rs.RecordCount
'判断记录集中的"客户ID"字段是否与子窗体中的"客户ID"相同
If rs("客户单位ID") = Me![khdwzl 子窗体]![客户单位ID] Then
rs.Delete 1
i = rs.RecordCount + 1
Else
rs.MoveNext
End If
Next i
MsgBox "客户资料删除成功!", vbOKOnly, "删除成功"
Me![khdwzl 子窗体].Requery
Set rs = Nothing
Exit_删除记录_click:
Exit Sub
Err_删除记录_click:
MsgBox Err.Description
Resume Exit_删除记录_click
End Sub |
|