String Conversion

Brook75

New member
Local time
Today, 16:58
Joined
Jan 22, 2007
Messages
6
Hi,

I am having some trouble converting a numeric field to a string within VB. The number is held as a currency field within an Access table, which is read into a recordset within VB and is being converted using the following :-

lo_string = "Description" + [VbCrLf] + CStr(lo_value)

When viewing the table the field shows the correct value (0.70) but when viewed in the string the field is displayed without the trailing zero (0.7).

Is there any way to ensure that preceeding and trailing zeroes are maintained when converting a number to a string.

Any help is much appreciated!
 
Code:
lo_string = "Description" & VbCrLf & Format(CStr(lo_value),"0.00")
 
I would suggest using Ampersands (&) for concatenating instead of plus signs (+) as the plus signs can get you into trouble when working with numbers (even in strings).
 
Thanks bob, that worked absolutely perfectly!

Have a good weekend!
 

Users who are viewing this thread

Back
Top Bottom