How can I add items to combo box without using ";" in additem method

J

Jareckipw

Hello

I have one problem in vba. I have combo box, which has e.g. 3 columns.
Then I want to add items to suitable columns without using ";"
separator.

cmb_name.additem "string1" + ";" + "string2" + ";" + "string3"

becease string1, string2, string3 can contain ";" mark as well

please give me any solution, which solves this problem.
thanks
 
C

Cindy M -WordMVP-

Hi Jareckipw,
I have one problem in vba. I have combo box, which has e.g. 3 columns.
Then I want to add items to suitable columns without using ";"
separator.

cmb_name.additem "string1" + ";" + "string2" + ";" + "string3"

becease string1, string2, string3 can contain ";" mark as well
Take a look at the List() property (for Forms) in the Word/Office VBA
Help files.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
J

Jaroslaw Kurek \(WP\)

Thanks for your help

But in Access 2003's help about List property
there is only an example how can I add items to combo box, which have only
one column:

with mycontrol
.additem Text:="String1", Index:=1
.additem Text:="String2", Index:=2
end with

so it will be that:

|string1|
|string2|

I can add items to combo, which have one columns, but what about
multicolumns.
----------------------------------------------------
but I would like to have below structure in combo box:

|string1|string2|string3| - first line
|string4|string5|string6| - second line

there isn't any example in help in Access 2003

now I use that code:

combo_name.additem "string1" + ";" + "string2" + ";" + "string3"
combo_name.additem "string4" + ";" + "string5" + ";" + "string6"

what about in case if at least one string will be contained ";"
for example :
"stri;ng2"

combo's structure will be following:

|string1|stri |ng2 | - first line
|string3|string4|string5| - second line
|string6| | | - third line

please any suggestions
 
C

Cindy M -WordMVP-

Hi Jaroslaw,
in Access 2003'
always a good idea to specify in WHICH application you're
working. In this case, the combobox could be on an Access
form, or in a VBA form, or in a toolbar.

I suggest you find an Access-specific group in which to ask
your question (just because there are very few Access
people in this group) and be sure to describe exactly WHERE
you have this combo-box.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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

Top