Hello,
I have a multiple selection listbox (datasource on a tble). I try to delete the selected row from the list box with that VBA:
Private Sub Command61_Click()
On Error GoTo Err_Exit_Click
Dim i
For Each i In ListInputBudget.ItemsSelected
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("W1_Budget Input")
rs.Delete
Next i
rs.Close
Set rs = Nothing
Set db = Nothing
Me.ListInputBudget.Requery
Exit_Exit_Click:
Exit Sub
Err_Exit_Click:
MsgBox Err.Description
Resume Exit_Exit_Click
End Sub
Problem is that it does not delete the selected line but the first line and follow...
Many thanks for whom is helping me.
I have a multiple selection listbox (datasource on a tble). I try to delete the selected row from the list box with that VBA:
Private Sub Command61_Click()
On Error GoTo Err_Exit_Click
Dim i
For Each i In ListInputBudget.ItemsSelected
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb
Set rs = db.OpenRecordset("W1_Budget Input")
rs.Delete
Next i
rs.Close
Set rs = Nothing
Set db = Nothing
Me.ListInputBudget.Requery
Exit_Exit_Click:
Exit Sub
Err_Exit_Click:
MsgBox Err.Description
Resume Exit_Exit_Click
End Sub
Problem is that it does not delete the selected line but the first line and follow...
Many thanks for whom is helping me.