Access vba: listbox additem multicolumn truncating on comma
I have a combobox with two colunms, but the first is hidden that adds values onto a listbox in the same manner. I am noticing that the list box is truncating the string in the second column.
This is my code thus far where cmbPart is the combobox and lstPart is the listbox.
Me.lstPart.AddItem (CStr(Me.cmbPart.Val开发者_JS百科ue) & " ;" & CStr(Me.cmbPart.Column(1, Me.cmbPart.ListIndex)))
I notice that that when there is a comma (,) in the string it stops displaying the rest from Me.cmbPart.Column(1, Me.cmbPart.ListIndex)
.
How can I stop the behavior?
Aperently strings with commas in to be added to a multicolunm listbox bust be enclosed in single quotes.
Me.lstPart.AddItem (CStr(Me.cmbPart.Value) & " ;" & CStr("'" & Me.cmbPart.Column(1, Me.cmbPart.ListIndex)) & "'")
精彩评论