Select ALL items in listbox (1 Viewer)

Kevin_S

Registered User.
Local time
Yesterday, 19:49
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
 

Mile-O

Back once again...
Local time
Today, 00:49
Joined
Dec 10, 2002
Messages
11,316
Like this?
 

Attachments

  • dbselectall97.zip
    14 KB · Views: 2,822

Kevin_S

Registered User.
Local time
Yesterday, 19:49
Joined
Apr 3, 2002
Messages
635
THANKS!!!!!!!!!!!!!!!! :D

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

I appreciate the response and the help!!

Take Care - Kevin
 

mattkorguk

Registered User.
Local time
Today, 00:49
Joined
Jun 26, 2007
Messages
301
The post is over 6 years old and still helping folk. Thank you.
(Search tool works!)
 

Trives_III

New member
Local time
Yesterday, 16:49
Joined
Dec 4, 2013
Messages
1
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~
 

blah

Registered User.
Local time
Yesterday, 16:49
Joined
Jun 23, 2011
Messages
21
12 years and counting.
 

Gasman

Enthusiastic Amateur
Local time
Today, 00:49
Joined
Sep 21, 2011
Messages
14,299
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

Top Bottom