Formatting CurrencySuppose you have a price list that is not currently formatted as currency, but you need it to appear as currency. You can use the FormatCurrency function to do this for you. Let's assume that a variable (we'll call it Price) has the value of 54.15. This needs to appear formatted as currency because it is a price. After formatting, you see $54.15
We have several choices on formatting here. When one or more optional arguments are specified (as in the above example), the format will be the same that's set in Regional Settings Currency on the server. Optional arguments are Number of Digits after Decimal, Include Leading Digit, and Use Parenthesis for Negative Numbers. On all of these, a value of -1 is True, 0 is false, and the value of -2 uses the default settings in the computer's regional settings. If, for example, we were figuring tax on an item and the value for Tax is .569, we can format Tax to just return two digits after the decimal point as follows: Tax is $0.57
Suppose now that we don't want the leading zero when we display the value of Tax. We can format it this way: $.57
Ooops! We've overcharged on Tax, and we now want to make it a negative number and display that negative number in parenthesis. We can apply another argument to do this. ($.57)
|