Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deselect all selections from a multiselect listbox

Status
Not open for further replies.

daseffects

Technical User
Aug 21, 2003
38
GB
I'm having a hell of a time trying to clear a multiselect listbox of all selections.

Bumped my head against listindex which I'm sure won't work for a multiselect listbox and have been trying to write a loop for selected with no luck.

Any thoughts greatly appreciated.

D
 
I take it be selecting the selections, that you do not want to clear the listbox, but simply un-selected the currently selected item. If that is correct, then the following loop should work for you.
Code:
Dim lCtl_CntrlSource       As Control
Dim lInt_CurrRow           As Integer
   
Set lCtl_CntrlSource = [Forms]![<Form Name>]![<ListBoxName]
For lInt_CurrRow = 0 To lCtl_CntrlSource.ListCount - 1
   lCtl_CntrlSource.Selected(lInt_CurrRow) = False
Next lInt_CurrRow
Changing the False to True will select all of the entries.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top