How to measure # of charactors for currency fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a currency field and want to get the number of charactors of this
currency field for a text control in the report. For example, if the value of
this Currency field is $52,234.32, I would like have 10 as the number of
charactors. If the value of the Currency field is $28.35, I would like have
5. Would anyone please let me know how you would handle this? Thanks!!!
 
I'm unsure as to how you arrived at 10 and 5. Assuming you're counting the
dollar sign, comma and decimal point, the first has 10 characters and the
second has 6.

To calculate that length, use the Format function (with "Currency" as the
format) to convert the value to a string, then use the Len function to
calculate its length:

?Format(52234.32, "Currency")
$52,234.32
?Len(Format(52234.32, "Currency"))
10
?Format(28.35, "Currency")
$28.35
?Len(Format(28.35, "Currency"))
6
 
Back
Top