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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox items - column delimitator

Status
Not open for further replies.

kolorasta

Technical User
Jul 2, 2002
65
AR
Do Until rs.EOF
item = CStr(rs("id")) + ";" + CStr(rs("fecha_vencimiento")) + ";" + rs("descripcion") + ";" + CStr(FormatPercent(rs("iva"), 2)) + ";" + CStr(FormatCurrency(rs("importe"), 2))
lista_deudas.AddItem (item)
rs.MoveNext
Loop


i've got the above code.. and i've got a problem too.
CStr(FormatPercent(rs("iva"), 2) = 27,00%
and
CStr(FormatCurrency(rs("importe"), 2)) = $126,40

I´ve got a listbox with x number of items and 5 column per item.
when i do an ADDITEM (string)... the string I use has ";" to seperate the different columns. BUT the currency column and the percentaje column have "," and Access asumes that the "," delimitates the columns too... and the result is a row with 7 columns instead of 5.

The fact is that I want to have a column in a listbox with "," in the string...
is it possible¿? how??



am i clear?
sorry for my poor english
 
You need to add a hyphen to each of your items.

Like so.

Item = "'" + CStr(rs("id")) + "';'" + CStr(rs("fecha_vencimiento")) + "';'" + rs("descripcion") + "';'" + CStr(FormatPercent(rs("iva"), 2)) + "';'" + CStr(FormatCurrency(rs("importe"), 2)) + "'"

Or.

list_Test.AddItem ("'$345,234';'something';'$3,234'")
list_Test.AddItem ("'$9,234';'Else';'$7,324'")
 
Hi
I find that if I put quotes around the item, it works. For example:
List 1;List 2;"27,0"

Hope I have understood your problem. :)
 
How are ya kolorasta . . . . .

Do not use plus [purple]+[/purple] to concatenate strings! Use the ampersand [purple]&[/purple] instead. Also [blue]Draknor39[/blue] is right . . . hyphens are required.
Code:
[blue]    item = "[red][b]'[/b][/red]" & CStr(rs("id")) & "[red][b]'[/b][/red];" & _
	   "[red][b]'[/b][/red]" & CStr(rs("fecha_vencimiento")) & "[red][b]'[/b][/red];" & _
	   "[red][b]'[/b][/red]" & rs("descripcion") & "[red][b]'[/b][/red];" & _
	   "[red][b]'[/b][/red]" & CStr(FormatPercent(rs("iva"), 2)) & "[red][b]'[/b][/red];" & _ 
	   "[red][b]'[/b][/red]" & CStr(FormatCurrency(rs("importe"), 2)) & "[red][b]'[/b][/red]"[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top