Comma in Multi-column Listbox

shadow9449

Registered User.
Local time
Yesterday, 19:11
Joined
Mar 5, 2004
Messages
1,037
The typical way to add an item to a list box is:

Code:
  Me.lstMyListbox.AddItem Item:= strStringToBeAdded

This works great if the list box is only one column. Should the list box happen to be two columns, the way it's done is:

Code:
Me.lstMyListbox.AddItem Item:= strFirstColumn & ";" & strSecondColumn

This also works great, unless the user's string happens to contain a comma. My problem is that I have a user who put a comma in her string and the list box is parsing it as a new column. Does anyone know a way around this? I suppose that a semicolon in a string would cause the same problem.

Thanks

SHADOW
 
parse it out first using the comma as the delimiter. split() is available, along with the parsing functions such as left(), right(), and mid().

i guess you can't stop the fact that Access treats delimiters the way it was programmed to do so. so that's impossible, but try what I mentioned above and see if it works. just remember that if you split it out, it becomes an array.
 
parse it out first using the comma as the delimiter. split() is available, along with the parsing functions such as left(), right(), and mid().

i guess you can't stop the fact that Access treats delimiters the way it was programmed to do so. so that's impossible, but try what I mentioned above and see if it works. just remember that if you split it out, it becomes an array.

That would be a lot of work because most strings do not contain commas so this would have to be conditional.

I should have posted this: I did some searching and I found that if you enclose the strings in quotes, then the comma problem is solved.

Thanks for your help :)

SHADOW
 

Users who are viewing this thread

Back
Top Bottom