Select ALL items in listbox

Kevin_S

Registered User.
Local time
Yesterday, 20:17
Joined
Apr 3, 2002
Messages
635
Hi everyone,

Not trying to double post a topic here (Forum Taboo for sure) just trying to look at a different solution to a listbox problem I posted last week. For those interested in the background on this subject check here:

http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=45343

What I am/was trying to do was to add an "ALL" item to a listbox that would be used to select all the items in sed box HOWEVER - this is a problem because the In() statement doesn't allow for wildcard selections which resulted in problems with this So...

To overcome this I was thinking of the possibility of working this a different way by using a command button to select all of the items in the listbox on the 'onclick' event. Has anyone ever done this or possibly have a demo they wouldn't mind sharing? I have done extensive searching on and I haven't found anything similar to this to date and I'm not that familiar with listbox controls.

Thanks for reading and for any help supplied!

Kevin
 
THANKS!!!!!!!!!!!!!!!! :D

Mile-O-Phile - that was exactly what I was looking for!!!

I appreciate the response and the help!!

Take Care - Kevin
 
The post is over 6 years old and still helping folk. Thank you.
(Search tool works!)
 
At 10 years old this code is still viable and helping folks! Just posting the snippet here that was useful to me! Incase you can't download it at work here's the code:

Dim intCounter As Integer ' create a loop counter

For intCounter = 0 To YourListBox.ListCount
YourListBox.Selected(intCounter) = True
Next intCounter

Thanks!
~P~
 
There is a bug in it however.

Once you have selected Deselect All, it does not work anymore.

This is due to the line

Code:
cmdSelectAll.Caption = "Deselect All"

in the Else part of the statement.

It should be
Code:
cmdSelectAll.Caption = "Select All"

I only point it out as some people copy code, not realising what each line does.
 

Users who are viewing this thread

Back
Top Bottom