There is no built-in way to do this, so you would have to write the
code yourself. Iterate over the SelectedItems collection, and call a
Delete query for each record.
Alternatively you can replace the listbox by a subform, which supports
automatic deletion.
Assuming that the bound column of your listbox is a numeric value that
corresponds to an ID field in your table, you could write some code for a
command button. I strongly recommend you copy your data and work with the
backup until this is working the way you want it to.
Private Sub cmd_Delete_Selected_Click
Dim strSQL as string, varItem as variant
For each varItem in me.lst_ListName.itemsselected
strSQL = "DELETE * FROM tbl_yourTable " _
& "WHERE [ID] = " & me.lst_ListName.Column(0, varItem)
currentdb.execute strsql, dbFailOnError
Next
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.