Keith
Registered User.
- Local time
- Today, 02:17
- Joined
- May 21, 2000
- Messages
- 129
I have a form with a multi select list box. I need the output to be a list of rows selected seperated by a comma. The code that I have puts a comma at the start of the line i.e , Secretary, Treasurer
Code:
Private Sub Command2_Click()
Dim frm As Form, ctl As Control
Dim varItm As Variant
Dim Res As String
Res = ""
Set frm = Forms!frmSelectOffice
Set ctl = frm!OfficeList
For Each varItm In ctl.ItemsSelected
Debug.Print ctl.ItemData(varItm)
Res = Res & ", " & ctl.ItemData(varItm)
Debug.Print Res
Next varItm
End Sub