Listbox, additem, changing delimiters

C

Cranley

When using 'additem' the standard delimiters are a comma
and semi-colon, however, if the item (string) one is
adding contains a comma or semi-colon it upsets the list
being displayed by the application.
I believe that I once saw some code that allowed one to
change the delimiters but I am now unable to find a way
of doing this.
 
W

Wayne Morgan

I just tried the following as a Row Source for a listbox. It placed a
semicolon in the list with Three and Four on the same row.

One;Two;"Three;Four";Five
 
C

Cranley

Thank you for your response and I am sorry for my delay.

My problem is that I am listing an organisation's Id,
name, abbreviated address and telephone number in one
line so that the user can double click in the one they
want and obtain full details.

I have a query that provides organisations sorted and
with an abbreviated address. The address is abbreviated
by first line of address and town, separated by '/' (eg
56 Frederick Street / Edinburgh). I would like to use a
comma or semi-colon but if I do the columns in the list
become confused.

Inside a do loop I have:

strTemp = !categoryId & ";" & !orgId & ";" & !orgName _
& !address & ";" & !telephone
Form_Organisations.listOrganisations.AddItem Item:=strTemp

The Listbox then displays the last three items in three
columns. It is the delimiters in strTemp that I wish to
be able to change. I did try putting another set of dips
around address but with no success.

Am I missing something?
 
W

Wayne Morgan

Is 56 Frederick Street / Edinburgh all included in !Address? If so, I would
recommend breaking it into two fields. However, going with what you have, if
the / was a comma try this to see if it works:

strTemp = !categoryId & ";" & !orgId & ";" & !orgName _
& """" & !address & """;" & !telephone
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top