Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > 源码示例

[示例]获取删除多条记录的信息并询问是否删除

时 间:2009-11-14 02:03:55
作 者:t小雨   ID:4598  城市:柳州
摘 要:询问是否删除数据表窗体多条记录并提示所选记录的信息
正 文:

方法一:
Option Compare Database
Option Explicit

Dim stDel As String
Dim inDel As Integer
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    Response = acDataErrContinue
End Sub
Private Sub Form_Delete(Cancel As Integer)
    If Me.SelHeight > inDel Then
        stDel = stDel & Chr(13) & "    " & Me.编号
        inDel = inDel + 1
        Cancel = True
    End If
   
    If Me.SelHeight = inDel Then
        If MsgBox("您正准备删除 " & inDel & " 条编号如下的记录:" & Chr(13) & stDel & Chr(13) & _
            Chr(13) & "删除后将不能撤消,确定删除吗?", vbExclamation + vbYesNo, "确认删除") = vbYes Then
            inDel = Me.SelHeight + 1
            DoCmd.RunCommand acCmdDeleteRecord
        End If
        inDel = 0
        stDel = ""
    End If
   
End Sub

方法二:
Option Compare Database
Option Explicit

Dim stDel As String
Dim inDel As Integer
Private Sub Form_BeforeDelConfirm(Cancel As Integer, Response As Integer)
    Response = acDataErrContinue
    If MsgBox("您正准备删除 " & inDel & " 条编号如下的记录:" & Chr(13) & stDel & Chr(13) & _
        Chr(13) & "删除后将不能撤消,确定删除吗?", vbExclamation + vbYesNo, "确认删除") = vbNo Then
        Cancel = True
    End If
End Sub
Private Sub Form_Delete(Cancel As Integer)
    stDel = stDel & Chr(13) & "    " & Me.编号
    inDel = inDel + 1
End Sub

 点击下载此附件



Access软件网QQ交流群 (群号:483923997)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助