Reset Listbox

  • Thread starter Thread starter XMan
  • Start date Start date
X

XMan

Is there a better to unselect selected items in listbox instead of calling
requery()?
I assume requery() will go do DB functions and may take more time as I have
many listboxes.
TIA.
 
Here's what I've used. I'm sure there's a better way, but at least it
works. lstName is the name of the listbox control.

Dim intDeSelectAll As Integer
Dim i As Variant

intDeSelectAll = lstName.ListCount

For i = 0 To intDeSelectAll
lstName.Selected(i) = False
Next

I believe you could use the Me.Refresh to remove the selections, however, if
I recall, if the user has selected all items then it would still display as
if all were still selected.

Connie
 
It's working.
Thanks for the tip!


Connie said:
Here's what I've used. I'm sure there's a better way, but at least it
works. lstName is the name of the listbox control.

Dim intDeSelectAll As Integer
Dim i As Variant

intDeSelectAll = lstName.ListCount

For i = 0 To intDeSelectAll
lstName.Selected(i) = False
Next

I believe you could use the Me.Refresh to remove the selections, however, if
I recall, if the user has selected all items then it would still display as
if all were still selected.

Connie
 
Back
Top