![]() |
|
|
#1
|
|||
|
|||
|
I use the following code to build a string from items selected in a listbox by the user:
__________________________________________________ _______ Private Sub SendEmail_Click() Dim varItem As Variant Dim strTO As String For Each varItem In Me.lstTO.ItemsSelected strTO = strTO & ",'" & Me.lstTO.ItemData(varItem) _ & "'" Next varItem End Sub __________________________________________________ _______ I would like however, to avoid having the user select the items but rather, build the string automatically from the table or at least have the code use all the items in the listbox, which are the same items in the table since I'm populating the listbox from the table. Any ideas? |
|
#2
|
|||
|
|||
|
Code:
For varItem = 0 To Me.lstTO.ListCount - 1
strTO = strTO & ",'" & Me.lstTO.ItemData(varItem) & "'"
Next varItem
__________________
John F |
|
#3
|
|||
|
|||
|
It worked like a charm. It was so simple I'm almost embarrassed.
Thanks JohnF. |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem creating new records using old values on same table. | gailoni | Programming | 0 | 10-22-2008 10:08 PM |
| Creating top values with two records | avesamuel | Queries | 0 | 10-15-2007 08:45 PM |
| Delete all records in a table? | bob646 | Access | 1 | 05-20-2007 09:41 PM |
How do I hide inactive records when creating a report in Acc
|
emily at KU | Reports | 1 | 12-06-2006 02:32 PM |
| Selecting and modifying records in a table | Ed H | Access | 1 | 03-17-2006 09:04 AM |