List Box Control

G

Guest

I use the following to fill a list box control. strItem = rs.Fields("PRI").Value & ";" & rs.Fields("Name"). My problem is the Name field has commas in it and when it is displayed in the list box, the data after the comma is displayed in another column. How do I get it to display in 1 column with the comma.
 
G

Guest

Look up the Replace Function: Replace(rs.Fields("Name"), "'", "''"

----- powerml wrote: ----

I use the following to fill a list box control. strItem = rs.Fields("PRI").Value & ";" & rs.Fields("Name"). My problem is the Name field has commas in it and when it is displayed in the list box, the data after the comma is displayed in another column. How do I get it to display in 1 column with the comma.
 
E

Elwin

strItem = rs.Fields("PRI").Value & ";" _
& Chr(34) & rs.Fields("Name") & Chr(34)
-----Original Message-----
I use the following to fill a list box control. strItem =
rs.Fields("PRI").Value & ";" & rs.Fields("Name"). My
problem is the Name field has commas in it and when it is
displayed in the list box, the data after the comma is
displayed in another column. How do I get it to display
in 1 column with the comma.
 

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