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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing a multiselect list box 2

Status
Not open for further replies.

DBAMJA

Programmer
Jul 25, 2003
169
US
Having a senior moment today and can't wrap my head around this question.

I have a list box with the multiselect property set to simple. After the user has selected all of the records and run the update for all of the records selected, I want to reset the list box so none of the records are selected but can't figure out how to do it. I know it should be easy but I just can't think straight today.

Thanks.

[flush]

DBAMJA

It is said that God will give you no more than you can handle. I just wish God didn't have so much faith in me.
 
Something like:
Code:
Dim varItm As Variant

    With List0

        For Each varItm In .ItemsSelected
            .Selected(varItm) = False
        Next varItm

    End With
Hope this helps

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before posting.

 
Thanks. I knew it was something easy, I just couldn't get my brain working today.

[flush]

DBAMJA

It is said that God will give you no more than you can handle. I just wish God didn't have so much faith in me.
 
How are ya DBAMJA . . .

... and this
Code:
[blue]   Me![purple][B][I]ListboxName[/I][/B][/purple].RowSource = Me![purple][B][I]ListboxName[/I][/B][/purple].RowSource[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
TheAceMan1,

How does that clear the selected items in a listbox rowsource?

I'm assuming it basically sets it back to the default rowsource, which would not have any items selected. Is that the case?

--

"If to err is human, then I must be some kind of human!" -Me
 
Howdy kjv1611 . . .

Anytime you write to the [blue]RowSource[/blue] of a listbox or combobox the control [blue]automatically requeries![/blue]

Also note: [ControlName].Requery doesn't work for a listbox, but does for a combobox!

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Thanks for the info.

--

"If to err is human, then I must be some kind of human!" -Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top