Siebel VB Language Reference > VB Language Reference >

CCur Function

This standard VB function converts an expression to the data type currency.





Any expression that evaluates to a number


The value of expression as a number of type currency.


CCur accepts any type of expression. Numbers that do not fit in the currency data type result in an Overflow error. Strings that cannot be converted result in a Type Mismatch error. Variants containing null result in an Illegal Use of Null error.


This example converts a yearly payment on a loan to a currency value with four decimal places. A subsequent Format statement formats the value to two decimal places before displaying it in a message box.

Sub Button_Click
Dim aprate, totalpay, loanpv
   Dim loanfv, due, monthlypay
   Dim yearlypay, msgtext
   loanpv = 5000
   aprate = 6.9
   If aprate >1 then
      aprate = aprate/100
   End If
   aprate = aprate/12
   totalpay = 360
   loanfv = 0
Rem Assume payments are made at end of month
   due = 0
   monthlypay = Pmt(aprate,totalpay,-loanpv,loanfv,due)
   yearlypay = CCur(monthlypay * 12)
   msgtext = "The yearly payment is: " & _
      Format(yearlypay, "Currency")
End Sub

See Also

CDbl Function
Chr Function
CInt Function
CLng Function
CSng Function
CStr Function
CVar Function
CVDate Function

Siebel VB Language Reference