请问如何使用复选框删除所有被选中的记录?
请帮忙修改以下代码,以达到效果。
Private Sub DeleteUser()
Dim strSelectUsers As String
Dim i As Integer ' placeholder
Set lvxObj = Me.ListView3.Object
' loop through the listview
For i = lvxObj.ListItems.Count To 1 Step -1
' check to see if the item is checked, if so, remove it
If lvxObj.ListItems(i).Checked = True Then
strSelectUsers = lvxObj.SelectedItem
DoCmd.SetWarnings False
DoCmd.RunSQL " delete from usysUsers where fusername ='" & strSelectUsers & "'"
DoCmd.SetWarnings True
'lvxObj.ListItems.Remove (i)
End If
Next i
End Sub
请帮忙修改以下代码,以达到效果。
Private Sub DeleteUser()
Dim strSelectUsers As String
Dim i As Integer ' placeholder
Set lvxObj = Me.ListView3.Object
' loop through the listview
For i = lvxObj.ListItems.Count To 1 Step -1
' check to see if the item is checked, if so, remove it
If lvxObj.ListItems(i).Checked = True Then
strSelectUsers = lvxObj.SelectedItem
DoCmd.SetWarnings False
DoCmd.RunSQL " delete from usysUsers where fusername ='" & strSelectUsers & "'"
DoCmd.SetWarnings True
'lvxObj.ListItems.Remove (i)
End If
Next i
End Sub
解决方案 »
- =======VB程序兼容性问题=========
- 如何使用vb向word文档中添加文字?
- 在MSHFlexGrid这个控件中,当我没有选中任何记录时,该控件缺省选中的是第1条记录(即row=1),这在使用中很不方便。如何才能使得在我没
- 关于窗口重新得到焦点的问题~在线等待
- 处理字符串的问题
- 请求解释一下菜单中的checked属性,它有何作用????
- 帮忙,哪里有msdn中文版下载
- 大家快来看呀,urldownloadtofile耍赖呀!!!!!!!
- VB做线程是否一定要编译成P代码才可运行?(高手们请回答)
- 数据库问题,急,谢谢
- VB 打印格式的问题
- 想在主函数中获得回调函数中的信息(但不使用模块级变量)可以实现么?
Dim strSelectUsers As String
Dim i As Integer ' placeholder
Set lvxObj = Me.ListView3.Object
' loop through the listview
For i = lvxObj.ListItems.Count To 1 Step -1
' check to see if the item is checked, if so, remove it
If lvxObj.ListItems(i).Checked = True Then
strSelectUsers = lvxObj.ListItems(i).Text
DoCmd.SetWarnings False
DoCmd.RunSQL " delete from usysUsers where fusername ='" & strSelectUsers & "'"
DoCmd.SetWarnings True
'lvxObj.ListItems.Remove (i)
End If
Next i
End Sub