Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox.AddItem problem

Status
Not open for further replies.

Azita79

Programmer
Jan 30, 2003
41
US
Hi All,

I am trying to add string variables which contain commas to a listbox.

let say my variable is "DAVID CRAIG CONSTRUCTION, INC"
the listbox looks like

DAVID GRAIG CONSTRUCTION
INC

so If my variable has 2 commas I get 3 lines!!

how can I fix this problem?

Azita
 
Embed the value within quotes and it will work.

Example with a listbox named List0:
Code:
    Me!List0.RowSourceType = "Value List"
    Me!List0.RowSource = Chr$(34) & "DAVID CRAIG CONSTRUCTION, INC" & Chr$(34) & ";"
    Me!List0.RowSource = Me!List0.RowSource & Chr$(34) & "TEST" & Chr$(34) & ";"
    Me!List0.RowSource = Me!List0.RowSource & Chr$(34) & "The """"Quoted"""" String" & Chr$(34)
Jim Kraxberger
Developing Access solutions since 1995
 
Hi,

Thank you so much Jim, it works fine now.


Azita

[thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top