obulldog27
Programmer
I am tring to delete a list item from a list box that is populated from a database table. When I use the following function only the first items on the list gets deleted rather then the item I have selected or highlighted.
Private delete_listitems()
compnamebox.Refresh
compnamebox.Recordset.MoveFirst
Do Until compnamebox.Recordset.EOF
If compnamebox.Recordset!ComponentName = Text1.Text Then
compnamebox.Recordset.Delete
compnamebox.Refresh
Exit Do
else if compnamebox.Recordset.EOF or
compnamebox.Recordset.BOF Then
Exit Sub
Else
compnamebox.Recordset.MoveNext
End If
Loop
End If
componentlist.Clear
Call populatecomponentcombobox
End Sub
Private delete_listitems()
compnamebox.Refresh
compnamebox.Recordset.MoveFirst
Do Until compnamebox.Recordset.EOF
If compnamebox.Recordset!ComponentName = Text1.Text Then
compnamebox.Recordset.Delete
compnamebox.Refresh
Exit Do
else if compnamebox.Recordset.EOF or
compnamebox.Recordset.BOF Then
Exit Sub
Else
compnamebox.Recordset.MoveNext
End If
Loop
End If
componentlist.Clear
Call populatecomponentcombobox
End Sub