This problem is driving me crazy since it should be straight forward.
I have a listbox "MyListBox" with RowSourceType = ValueList. The list is filled by the user selecting items from another bound listbox, this works OK by just appending the new item text to the RowSource string with an appropriate ";".
However, I would like to be able to delete an item from "MyListBox" when the user clicks on the item in the list he wants removed.
I've looked at the help and tried to use variously the RemoveItem method, Delete and Clear, None of which seem to work.
I think I can do it by manipulating the RowSource string to chop out the unwanted item using Instr(), Left(), Right(), etc. then reassign the string to RowSource and Requery the listbox. But this seems a very inelegant solution not to say slow.
Is there a one line command to remove a given item from a listbox?
Any help would be appreciated.
I have a listbox "MyListBox" with RowSourceType = ValueList. The list is filled by the user selecting items from another bound listbox, this works OK by just appending the new item text to the RowSource string with an appropriate ";".
However, I would like to be able to delete an item from "MyListBox" when the user clicks on the item in the list he wants removed.
I've looked at the help and tried to use variously the RemoveItem method, Delete and Clear, None of which seem to work.
I think I can do it by manipulating the RowSource string to chop out the unwanted item using Instr(), Left(), Right(), etc. then reassign the string to RowSource and Requery the listbox. But this seems a very inelegant solution not to say slow.
Is there a one line command to remove a given item from a listbox?
Any help would be appreciated.