count number of characters in numeric field

Eyor

Registered User.
Local time
Today, 08:07
Joined
Jul 13, 2006
Messages
26
Does anyone know the syntax to count the number of characters in a numeric field?

If not, how about counting the number of characters in a string?
 
Matt,

Thanks for the response.

This works but, it also counts the decimal point. Is there any way to either exclude the decimal point or subtract 1 if there is a decimal present?
 
If the database field is numeric, do this:

Len( CStr( [field] ) )

I.e. convert it to a string and then test its length.

If it is in a form, it is a text box, for which the length of the string doesn't require the extra conversion.
 
Oops, your post and mine must have crossed.

If the field is SINGLE or DOUBLE, converting it will require something more complex. But you can't possibly want what you are actually asking to see. So what is it that you REALLY wanted to know?
 
The database stores a [results] numeric field and an associated [sigfigs] numeric field. I need to combine the two in a query like so:

If number of characters in result < value of sigfig, find n= [sigfig] - [number of characters in result], CStr[result] and add n number of 0's to end of result

or something like this. Hopefully it is possible, this will save a lot of hassle later.
 

Users who are viewing this thread

Back
Top Bottom