Unselecting items in multi select list box

C

cherman

I have a list box set to multi select and a dropdown field. I want to
unselect any selected item in my list box on After Update of combp box.

I figure you have to cycle through the ItemsSelected and then turn it off,
but I cannot figure out how to do it. This is the last bit of code I tested:

Dim ctl As Control, varItem As Variant

Set ctl = Me.lstSAL

For Each varItem In ctl.ItemsSelected
ctl.ItemsSelected(varItem) = False
Next varItem

Can anyone help?
 
J

Joerg Ackermann

cherman:
I have a list box set to multi select and a dropdown field. I want to
unselect any selected item in my list box on After Update of combp
box.

I figure you have to cycle through the ItemsSelected and then turn it
off, but I cannot figure out how to do it. This is the last bit of
code I tested:

Dim ctl As Control, varItem As Variant

Set ctl = Me.lstSAL

For Each varItem In ctl.ItemsSelected
ctl.ItemsSelected(varItem) = False
Next varItem

Can anyone help?


Dim ctl As Control, varItem As Variant

Set ctl = Me.lstSAL

For Each varItem In ctl.ItemsSelected
ctl.Selected(varItem) = False
Next varItem

HTH
Acki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top