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

Format Variable as Currency or Number 1

Status
Not open for further replies.

saw15

Technical User
Jan 24, 2001
468
US
I am using vbscript to retrieve data out of an Oracle database and populating a variable.

I would like to format this variable (two of them) as currency and numbers.

I need this as numbers with commas.
TotalClaims = RecordSet("TotalClaims")

I need this as currency with commas etc.
TotalPaid = RecordSet("TotalPaid")

Help is appreciated.
 
Hi,
VbScript has these functions available to you
first
syntax:
FormatCurrency(Expression[,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])

second:
FormatNumber(Expression [,NumDigitsAfterDecimal [,IncludeLeadingDigit [,UseParensForNegativeNumbers [,GroupDigits]]]])

here's a little example with both to 2 decimal places
dim one, two
one = FormatNumber("1000000",2)
alert one
two = FormatCurrency("1000000",2)
alert two

if you want no decimal places in the first number then set it to 0

hope that helps out A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top