Deleting Items from List Boxes

Dembrey

Registered User.
Local time
Today, 16:14
Joined
Mar 6, 2002
Messages
65
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.
 
Not to my knowledge.
If your listbox is based on a value list, I believe you are bound to do it through string processing. (methods for listboxes based on a table or query are not lighter anyway).

Alex
 
Thanks Alex/David.

String Chopping here I come.
 

Users who are viewing this thread

Back
Top Bottom