Is there a way to change all items in a listbox to selected or de-selected
via code in one step? i.e. without looping through the ItemsSelected(I)
collection and changing each item to true or false?
Rick Brandt - 29 Dec 2006 13:05 GMT
> Is there a way to change all items in a listbox to selected or
> de-selected via code in one step? i.e. without looping through the
> ItemsSelected(I) collection and changing each item to true or false?
Without looping? No way I know of. And you wouldn't loop through the
ItemsSelected collection anyway as that would provide no access to rows not
already selected. You would loop using the ListCount value to control the
number of loops and the row being accessed.

Signature
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Douglas J. Steele - 29 Dec 2006 15:19 GMT
Deselecting all is easy: simply reset the RowSource or set the Listbox to
Null (the latter doesn't work for MultiSelect = Simple)
Selecting all can't be done without looping.

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
> Is there a way to change all items in a listbox to selected or de-selected
> via code in one step? i.e. without looping through the ItemsSelected(I)
> collection and changing each item to true or false?