I have an unbound list box with banana, orange, pear, apple, grapes as the items. When I select one, the selection is written to the a table in the field equipment purchased. If multiple are selected, then it writes all the items to the equipment purchase field separated by a semi-colon. But if I go back to the record later because someone has purchased a new item, the data that use to be there gets overwritten. The code looks like this:
Private Sub cmdButton_Click()
MyTextBox = ""
Dim intCnt, intNum As Variant
For Each intCnt In MyListBox.ItemsSelected
intNum = intNum + 1 'This numerator will determine if there is
If intNum = 1 Then 'more than one item selected.
MyTextBox = MyListBox.ItemData(intCnt)
Else 'If so then it will add a semicolon.
MyTextBox = MyTextBox & "; " & MyListBox.ItemData(intCnt)
End If
Next
End Sub
Any help you have will be greatly appreciated!!!!