10-02-2005, 07:10 AM
I am wondering how to place a comma "," in a certain spot in a value. Example: My value is: 10374 How would I say "place a comma before every 3 numbers BUT no comma if there is no numbers after the first 3 numbers" so I get an output of: 10,374 or something like 103,566,103? I am reading my value from a textfile. Any comments or suggestions would be appreciated.
10-03-2005, 02:14 PM
FormatNumber(Expression [,Decmals [,LeadDigits[,ParensForNeg [,GroupDigits]]]])
The FormatNumber function syntax has these parts:
Expression: Required. Expression to be formatted.
Decimals: Optional. Numeric value indicating how many places to the right of the decimal are displayed. Default value is -1, which indicates that the computer's regional settings are used.
LeadingDigits: Optional. Tristate constant that indicates whether or not a leading zero is displayed for fractional values. See Settings section for values.
ParensForNeg: Optional. Tristate constant that indicates whether or not to place negative values within parentheses. See Settings section for values.
GroupDigits: Optional. Tristate constant that indicates whether or not numbers are grouped using the group delimiter specified in the control panel. See Settings section for values.
TristateTrue -1 True
TristateFalse 0 False
TristateUseDefault -2 Use the setting from the computer's regional settings.
Here is the entire FormatNumber explanation.
What you want is FormatNumber(yourVar,,,,-1)
04-16-2007, 04:14 PM
I had this problem too, and was able to solve it in the meanwhile, but I have an additional question: if the output has a negative value, it's possible to put brackets around it, but is it also to format the output in a different color ?
I've found somewehere to use the following code, but it doesn't seem to work:
If rs.Fields("FIELDNAME") < 0 Then SetTextColor(RGB(201,4,2)) Else
This is the code to show the values from the database:
I tried to add the lines of code with If else just before the code to show the values, but it doesn't work for me. Does anyone know how to get this working ? I'm quite sure it's quite simple, but I'm more into PHP than ASP...
04-18-2007, 01:59 PM
Just use HTML formatting or CSS