>>>>>>Hello all! I have just added a listbox to a form in my application and set the multiselect property to .T. The listbox is working fine, I am trying to figure out how to store the data the user selects so that I can use it as search criteria in a SQL statement. Can anyone shed some light on this for me?
>>>>>>
>>>>>>TIA!
>>>>>
>>>>>You have to spin through the entire contents of the ListBox and check the Selected property of each entry.
>>>>>
>>>>>FOR x=1 TO oList.ListCount
>>>>> IF oList.Selected(x)
>>>>> * item is selected
>>>>> ENDIF
>>>>>ENDFOR
>>>>
>>>>
>>>>How would you handle it if someone selects an item and then deselects it? How would I remove it from the list?
>>>
>>>What's to handle? You would move your items to a selected table or an array or whatever method you use on LostFocus or something like that. If they've unselected an item, it won't show up as selected any more.
>>
That was what I was looking for....thank you so much!
>>
>>That makes sense. I am obviously doing something wrong, though, because I am getting the same value in the array. I am entering values in the array by using This.value, which is obviously not right. Can you tell me what I should be using instead?
>
>Did you check my reply?
>
>You should use listbox.List[i] if your listbox has only only column.