Re: currency format by ekkehard
ekkehard
Wed Mar 19 09:24:15 CDT 2008
RICK schrieb:
> How do you format the following for currency?
>
> <%
> varAmt = rsTemp.Fields("SAmount")
> %>
>
> Is it something like the following? The following doesn't however.
>
> <%
> varAmt = String.Format("{0:c}", rsTemp.Fields("SAmount"))
> %>
The VBScript way to format a currency value is to use the
FormatCurrency() function.
If you want to use .NET formatting, you may use a function
like this:
'' DNIPrintF( sFmt, aItems ) - use .NET to sprintf()
' ----------------------------------------------------------------------------
Function DNIPrintF( sFmt, aItems )
Dim oSB : Set oSB = CreateObject( "System.Text.StringBuilder" )
oSB.AppendFormat_4 sFmt, (aItems)
DNIPrintF = oSB.ToString()
End Function
e.g.
varAmt = DNIPrintF( "{0:c}", Array( rsTemp.Fields("SAmount").Value ) )