PDA

View Full Version : [SOLVED:] Listbox Problem with multi-select



lawsonbooth
11-14-2015, 04:21 PM
Please accept my thanks for any help in advance.

I have a multi-select listbox of hyperlinks and trying to insert selected into Outlook mail iteem from Access. The body is not HTML. I have to use plain text.

Could someone look at the following code and tell me why only the first selected item column(2) prints for all items selected in list. If I select items 2, 5, 7 and run the code item 2 column(2) prints 3 times, I do not get 5 & 7.
VBA

''add links to body
If Me.lstLinks.ListCount <> 0 Then
For n = 0 To (Me.lstLinks.ListCount - 1)
If Me.lstLinks.Selected(n) = True Then
xStrLink = Me.lstLinks.Column(2)
xBody = xBody & vbCrLf & vbCrLf & xStrLink
End If
Next n
End If

Thanks, Lawson