Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

Formatting Number with a Comma for thousands

I have 51152 coming in from a recordset.  How do I response.write that with a comma separator like 51,152?
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

You should be able to do this with the formatNumber() function:

http://www.devguru.com/Technologies/vbscript/quickref/formatnumber.html

FtB
ASKER CERTIFIED SOLUTION
Avatar of bvinson
bvinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could also use FormatNumber(objRS("YourField"),0) if you don't want any numbers after the decimal.  The number after the comma specifies the number of digits after the decimal.  

Here is more information:
http://www.w3schools.com/vbscript/func_formatnumber.asp

The link Fritz gave is a great reference as well...

bvinson
i agree with bvison

but i think you may need to set it out like this:

Response.write FormatNumber(objRS("YourField"),0,0)

Apresto

>>i agree with bvison<<

Hey! I was the first to suggest FormatNumber() !!!! http:#14014044


;->


FtB
Its true...Fritz has the quicker fingers.  I felt like I was racing him all afternoon in trying to respond to questions.  :)  He always entered his response while I was still typing mine.

bvinson
>>He always entered his response while I was still typing mine.<<

It's callled COFFEE!!!

FtB
lol - your right sorry ftb i think unintentianally hopped to the last comment posted

bvisons is right though, your like a machine ftb!!!

ftb - the Terminator...Ill Post Back!! :o)
I am glad that formatNumber() worked for you. Did you not see my post then?