Deselect All in List Box

P

Pamela

I have a multi-select List Box on my form. Is there a way for the user to
Deselect All if they make a mistake and click on an Item in the box? I just
made the mistake myself in trial and while I can change the Item(s) selected,
I'm not being able to deselect all. Thanks so much!

Pamela
 
A

Arvin Meyer [MVP]

Here's one that clears a listbox on one of my forms:

Dim varItem As Variant

For Each varItem In Me.lstElevation.ItemsSelected
Me.lstElevation.Selected(varItem) = 0
Next varItem
Me.lstElevation.Requery
 
P

Pamela

Thanks, Guys! I was getting ready to test it out when I found that if I
simply hold down Ctrl as I click even the last item in the box that it will,
indeed, deselect all. When I tried it before, I was just single clicking.

Thanks!
 

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