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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|