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

Deselecting values in multiselect box 2

Status
Not open for further replies.

bravid98

Programmer
Jun 6, 2001
7
US
I'm having trouble clearing the selections in a multiselect box. Setting the control null does nothing and I've had no luck figuring out some code on my own. Anyone able to give me a hand?
 
Try this code:

ListBoxName = ""

That works for me.

Joe Miller
joe.miller@flotech.net
 
I've been trying Me.ListBoxName = "" with no luck. I just want to clear any selections the user has made and am pulling my hair out right now!
 
Are you getting some kind of error? I can send you an example if you provide me your email address...
Joe Miller
joe.miller@flotech.net
 
Was this problem (listbox being cleared) ever solved? Would it be possible to post an update here?
Thanks
Jane
 
I never got the problem resolved, I just simply made the form close and reopen to clear all fields.
 
E-mail me so I can send you an example database.

Joe Miller
joe.miller@flotech.net
 
Hi Joe, if you could send the db to jmcconnell @genzyme.com
(remove the space). Thank you very much in advance
 
Joe, you are using an extended list box, if I change my list to extended this works too but I need to use a simple list box. When a simple list box is used this doesnt work!
I need the simple list as they need to be able to select non contigous entries ( or am I wrong and they can do this in extended?)
For anyone reading this thread- it does work well with an extended list box.
 
Jane,

Ok, I got you now. I fixed it.. Change the code of the click event for clear to this:

[tt]
Dim i As Integer

For i = 0 To (lstGroceries.ListCount - 1)
lstGroceries.Selected(i) = False
Next i
[/tt]

Then it will clear for a simple listbox, as well as an extended. Sorry for my mixup.

Joe Miller
joe.miller@flotech.net
 
Thank you Joe, it works! I was trying to work on something similar but I am not great with For loops.
 
Good, glad you got it.

BTW, you CAN select non-contiguous in extended listboxes, the difference is that the user has to use modifier keys (SHIFT, CTRL) like they do in other windows apps, like explorer. CTRL+Click allows you to select any values (like the simple), and Click an item then SHIFT+Click selects all items between. I usually use the extendeds, because most of my users are familiar with the conventions.

HTH Joe Miller
joe.miller@flotech.net
 
How do I check for a specific value in a multiselect listbox? I have a multiselect listbox. I would like to "clear" the listbox if the user selects "None". "None" is included in the listbox record source.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top