开发者

Access vba: listbox additem multicolumn truncating on comma

开发者 https://www.devze.com 2023-04-12 21:06 出处:网络
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.

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)) & "'")
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号