A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Select All in a listbox



 
 
Thread Tools Display Modes
  #1  
Old May 9th, 2009, 01:58 AM posted to microsoft.public.access
sweeneysmsm
external usenet poster
 
Posts: 74
Default Select All in a listbox

Is there a way to select all of the records in a listbox instead of having to
select each one individually?

I am using the listbox to send stored e-mail addresses so that a report can
be sent out. In some instances I might want to select individuals, but in
others I might want to select all. I have tried the usual Shift key while
establishing a block but that does nothing.

Thanks for whatever insight you can provide.

Mary
  #2  
Old May 9th, 2009, 03:07 AM posted to microsoft.public.access
Ken Snell MVP
external usenet poster
 
Posts: 275
Default Select All in a listbox

Change the Multiselect property to Extended.

You then can select the first item, scroll down to the end of the list, hold
down the Shift key, and click on the last item.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"sweeneysmsm" wrote in message
...
Is there a way to select all of the records in a listbox instead of having
to
select each one individually?

I am using the listbox to send stored e-mail addresses so that a report
can
be sent out. In some instances I might want to select individuals, but in
others I might want to select all. I have tried the usual Shift key while
establishing a block but that does nothing.

Thanks for whatever insight you can provide.

Mary



  #3  
Old May 9th, 2009, 05:28 PM posted to microsoft.public.access
[email protected]
external usenet poster
 
Posts: 129
Default Select All in a listbox

Mary:

If you want to do it by means of a 'Select All' button on the form the
code for its Click event procedure would be like this:

Dim n As Integer
Dim ctrl As Control

Set ctrl = Me.YourListBoxName

For n = 0 To ctrl.ListCount - 1
ctrl.Selected(n) = True
Next n

Similarly, for a 'Clear Selections' button:

Dim n As Integer
Dim ctrl As Control

Set ctrl = Me.YourListBoxName

For n = 0 To ctrl.ListCount - 1
ctrl.Selected(n) = False
Next n

Ken Sheridan
Stafford, England

On May 9, 1:58 am, sweeneysmsm
wrote:
Is there a way to select all of the records in a listbox instead of having to
select each one individually?

I am using the listbox to send stored e-mail addresses so that a report can
be sent out. In some instances I might want to select individuals, but in
others I might want to select all. I have tried the usual Shift key while
establishing a block but that does nothing.

Thanks for whatever insight you can provide.

Mary


  #4  
Old May 9th, 2009, 08:22 PM posted to microsoft.public.access
sweeneysmsm
external usenet poster
 
Posts: 74
Default Select All in a listbox

Thank you so much. That was perfect.

Mary

"Ken Snell MVP" wrote:

Change the Multiselect property to Extended.

You then can select the first item, scroll down to the end of the list, hold
down the Shift key, and click on the last item.

--

Ken Snell
MS ACCESS MVP
http://www.accessmvp.com/KDSnell/


"sweeneysmsm" wrote in message
...
Is there a way to select all of the records in a listbox instead of having
to
select each one individually?

I am using the listbox to send stored e-mail addresses so that a report
can
be sent out. In some instances I might want to select individuals, but in
others I might want to select all. I have tried the usual Shift key while
establishing a block but that does nothing.

Thanks for whatever insight you can provide.

Mary




  #5  
Old May 9th, 2009, 08:23 PM posted to microsoft.public.access
sweeneysmsm
external usenet poster
 
Posts: 74
Default Select All in a listbox

Thank you, Ken. I think I will just go with the extended multi-select but I
am grateful to have the code you sent.

Mary

" wrote:

Mary:

If you want to do it by means of a 'Select All' button on the form the
code for its Click event procedure would be like this:

Dim n As Integer
Dim ctrl As Control

Set ctrl = Me.YourListBoxName

For n = 0 To ctrl.ListCount - 1
ctrl.Selected(n) = True
Next n

Similarly, for a 'Clear Selections' button:

Dim n As Integer
Dim ctrl As Control

Set ctrl = Me.YourListBoxName

For n = 0 To ctrl.ListCount - 1
ctrl.Selected(n) = False
Next n

Ken Sheridan
Stafford, England

On May 9, 1:58 am, sweeneysmsm
wrote:
Is there a way to select all of the records in a listbox instead of having to
select each one individually?

I am using the listbox to send stored e-mail addresses so that a report can
be sent out. In some instances I might want to select individuals, but in
others I might want to select all. I have tried the usual Shift key while
establishing a block but that does nothing.

Thanks for whatever insight you can provide.

Mary



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:04 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.