Tuesday, March 27, 2012

How to put comma or semicolon in Listbox using AddItem

If you try to add list item, containing text with comma or semicolon, to Access listbox using .AddItem method - item will be split into rows, listbox interpret comma as separator:

Me.List0.AddItem "One, two, three"

image

The trick is to put string in quotes:

Me.List0.AddItem "'One, two, three'"

image

No comments:

Post a Comment