Connecting Tech Pros Worldwide Help | Site Map

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

Jareckipw
Guest
 
Posts: n/a
#1: Nov 13 '05
Hello

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

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

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

please give me any solution, which solves this problem.
thanks
jimfortune@compumarc.com
Guest
 
Posts: n/a
#2: Nov 13 '05

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


Private Sub Form_Load()
cbxMyList.RowSourceType = "Value List"
cbxMyList.RowSource = Chr(34) & "3;C" & Chr(34) & ";" & Chr(34) & "4;F"
& Chr(34)
End Sub

created the following dropdown:
3;C
4;F

Does this solve your problem?

James A. Fortune

Nick Coe \(UK\)
Guest
 
Posts: n/a
#3: Nov 13 '05

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


In news:51e2ff2d.0504252054.2efe98dc@posting.google.c om,
Jareckipw typed:[color=blue]
> Hello
>
> I have one problem in vba. I have combo box, which has for
> example 3 columns. Then I want to add items to suitable
> columns without using ";"
> separator.
>
> cmb_name.additem "string1" + ";" + "string2" + ";" +
> "string3"
>
> becaase string1, string2, string3 can contain ";" mark as
> well
>
> please give me any solution, which solves this problem.
> thanks[/color]


My first thought is to use a table which you clear then fill
with the rows you want in code. Then just use a Select in
the source for the combo. BUT, I can't remember if having a
; anywhere in the returned string will work. It still might
be worth trying...

--
Nick Coe (UK)
Available - Will work for money :-)
http://www.alphacos.co.uk/ AccHelp + pAnimal
http://www.pjandcoe.co.uk/ TShirts with Bark Factor!


Jareckipw
Guest
 
Posts: n/a
#4: Nov 13 '05

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


jimfortune@compumarc.com wrote in message news:<1114498679.325661.83280@o13g2000cwo.googlegr oups.com>...[color=blue]
> Private Sub Form_Load()
> cbxMyList.RowSourceType = "Value List"
> cbxMyList.RowSource = Chr(34) & "3;C" & Chr(34) & ";" & Chr(34) & "4;F"
> & Chr(34)
> End Sub
>
> created the following dropdown:
> 3;C
> 4;F
>
> Does this solve your problem?
>
> James A. Fortune[/color]

Thanks for your reply. This code solves my problem. I'm grateful.
I try work out this issue but I use only additem.


You notice that this work only with rowsourcery , doesn't work with
additem.:) It is very strange.
But I'm glad that that code works.

Thx
Jarosław Kurek
Warsaw University of Technology.
Warsaw
Closed Thread