G
Guest
I want to let users delete (multiple) records from a table that they select
in a list box. I am able to write the outline of the required code, but
honestly don't know how to do the actual deletion. I list my code below, and
wonder if anyone can complete the puzzle for me. Thank you. Code:
Private Sub cmdDeleteRecord_Click()
On Error GoTo Err_cmdDeleteRecord_Click
Dim ctl As Control
Dim rst As Recordset
Dim intCurrentRow As Integer
Set ctl = Me!lstARReportLog
For intCurrentRow = 0 To ctl.ListCount - 1
If ctl.Selected(intCurrentRow) Then
'HERE I don't knnow how to do the actual deletion of that row.
End If
Next intCurrentRow
'Next line is screen refresh
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_cmdDeleteRecord_Click:
Exit Sub
Err_cmdDeleteRecord_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteRecord_Click
End Sub
in a list box. I am able to write the outline of the required code, but
honestly don't know how to do the actual deletion. I list my code below, and
wonder if anyone can complete the puzzle for me. Thank you. Code:
Private Sub cmdDeleteRecord_Click()
On Error GoTo Err_cmdDeleteRecord_Click
Dim ctl As Control
Dim rst As Recordset
Dim intCurrentRow As Integer
Set ctl = Me!lstARReportLog
For intCurrentRow = 0 To ctl.ListCount - 1
If ctl.Selected(intCurrentRow) Then
'HERE I don't knnow how to do the actual deletion of that row.
End If
Next intCurrentRow
'Next line is screen refresh
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_cmdDeleteRecord_Click:
Exit Sub
Err_cmdDeleteRecord_Click:
MsgBox Err.Description
Resume Exit_cmdDeleteRecord_Click
End Sub