I need to count the digits of a number

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

I have a field with numbers added. Is it possible to have the number of
digits of every record?
For example if in a record the number 123456789 is entered I need to have
the number 9 entered in another field. If 12345 is entered I need number 5
and so on. The numbers are not entered in any specific order.
Can someone help?
Thanks
Jimmy
 
Jimmy said:
I have a field with numbers added. Is it possible to have the number
of digits of every record? For example if in a record the number
123456789 is entered I need to have the number 9 entered in another
field. If 12345 is entered I need number 5 and so on. The numbers are
not entered in any specific order. Can someone help? Thanks Jimmy

Please don't store that number of digits, it is against database
normalization rules.

There is no built-in function for number length. You can do it
mathematically, getting the 10log of the number; or you can do a string
excursion.
The number of digits in a number is equal to the number of characters in
the string that number converts into.
To convert a number into a string, use Format(theNumber).
To get the length of a string, use Len(string).

Together:

Len(Format(yourNumber))

will do.
 
Back
Top