Office中国论坛/Access中国论坛
标题:
关于小宝的《删除多条信息》,我有个疑问.....
[打印本页]
作者:
goto2008
时间:
2009-12-12 00:00
标题:
关于小宝的《删除多条信息》,我有个疑问.....
本帖最后由 goto2008 于 2009-12-12 00:15 编辑
关于小宝《删除多条信息》的疑问,怎么解决?请指教
作者:
t小宝
时间:
2009-12-13 13:04
原因是选择了新记录引起的,添加2句代码取消选择新记录即可。
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.SelTop + Me.SelHeight - 1 > Me.RecordsetClone.RecordCount Then
Me.SelHeight = Me.SelHeight - 1
End If
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
作者:
goto2008
时间:
2009-12-13 16:07
可以了,谢谢小宝
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3