删除记录的几种方法示例
Private Sub cmdDelete_Click() '删除当前记录
If Not Me.NewRecord Then
RunCommand acCmdDeleteRecord
MsgBox "当前记录已删除成功!", vbInformation, "提示"
Else
Me.Undo
End If
End Sub
Private Sub Command45_Click() '删除选中记录
On Error Resume Next
Dim strsql As String
Dim intCount As Long
intCount = DCount("id", "tbl前区统计指标", "删除 = -1")
If intCount = 0 Then
MsgBox "你还没选中记录,不能删除!", vbInformation, "提示"
Exit Sub
Else
If (MsgBox("你真的要删除 " & intCount & " 条选中的记录吗?", vbQuestion + vbYesNo, "提示") = vbYes) Then
strsql = "delete * from tbl前区统计指标 where 删除=-1"
DoCmd.RunSQL strsql
Me.Requery
MsgBox "已删除 " & intCount & " 条选中记录!", vbInformation, "提示"
Else
Exit Sub
End If
End If
End Sub
Private Sub Command46_Click() '清除所有记录
Dim intCount As Long
intCount = DCount("id", "tbl前区统计指标")
If (MsgBox("你真的要删除所有( " & intCount & " 条)的记录吗?", vbQuestion + vbYesNo, "提示") = vbYes) Then
strsql = "delete * from tbl前区统计指标"
DoCmd.RunSQL strsql
Me.Requery
MsgBox "已删除所有( " & intCount & " 条)记录!", vbInformation, "提示"
Else
Exit Sub
End If
End Sub
1.《md如何删除、md删除固定针!》援引自互联网,旨在传递更多网络信息知识,仅代表作者本人观点,与本网站无关,侵删请联系页脚下方联系方式。
2.《md如何删除、md删除固定针!》仅供读者参考,本网站未对该内容进行证实,对其原创性、真实性、完整性、及时性不作任何保证。
3.文章转载时请保留本站内容来源地址,https://www.lu-xu.com/keji/3296000.html