Neil2526
asked on
Access looping through a listbox and grabbing values
I have a list box that has a list of emails. I want to loop through the values and make a list to shoot off emails.
Surprisingly I haven't really found anything on google that would help me do this.
emailNumber = Me.List0.ListCount
For i = 0 To emailNumber - 1
emailList = Me.List0.ItemData & "; " & emailList
Next i
Thank you.
Surprisingly I haven't really found anything on google that would help me do this.
emailNumber = Me.List0.ListCount
For i = 0 To emailNumber - 1
emailList = Me.List0.ItemData & "; " & emailList
Next i
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the response capricorn.
I partly used your code, and did this:
For i = 0 To emailNumber - 1
With Me.List0
If .ItemsSelected.Count > 0 Then
emailList = emailList & .ItemData(j) & ";"
End If
End With
Next i
But when looping, it seems to only grab my first item in the list. So emailList looks like:
ed@ed.com;ed@ed.com;ed@ed. com
thanks.
I partly used your code, and did this:
For i = 0 To emailNumber - 1
With Me.List0
If .ItemsSelected.Count > 0 Then
emailList = emailList & .ItemData(j) & ";"
End If
End With
Next i
But when looping, it seems to only grab my first item in the list. So emailList looks like:
ed@ed.com;ed@ed.com;ed@ed.
thanks.
ASKER
nevermind. i got it!
i needed to use 'i' instead of 'j'
thanks!
i needed to use 'i' instead of 'j'
thanks!
emaillist=left(emailList,l