I am not good at VBA at all. I have dabbled a little bit building this database, but I still can't even really read it, I just know what certain strings mean. I'm trying to get a list box populated with names and e-mails to return the e-mails in a list, and separated by semicolons. Microsoft's support pages got me some code to use, but when I hit the command button, it returns the ID field for the names, and I have no idea how to change it.
That is the code that I'm using, and if anyone could help me it would be greatly appreciated.
Code:
Private Sub testmultiselect_Click()
Dim oItem As Variant
Dim sTemp As String
Dim iCount As Integer
iCount = 0
If Me!NamesList.ItemsSelected.Count <> 0 Then
For Each oItem In Me!NamesList.ItemsSelected
If iCount = 0 Then
sTemp = sTemp & Me!NamesList.ItemData(oItem)
iCount = iCount + 1
Else
sTemp = sTemp & "; " & Me!NamesList.ItemData(oItem)
iCount = iCount + 1
End If
Next oItem
Else
MsgBox "Nothing was selected from the list", vbInformation
Exit Sub 'Nothing was selected
End If
Me!mySelections.Value = sTemp
End Sub
That is the code that I'm using, and if anyone could help me it would be greatly appreciated.