Trim Numbers (1 Viewer)

Crilen007

Uhm, Title... *shrug*
Local time
Today, 05:20
Joined
Jun 13, 2003
Messages
531
Tried to search for this, maybe I am searching the wrong term.

Anyways.. I have a table linked from a large mainframe, and what I am trying to do is trim any numbers that are 1 million and over, and still keep it a number.

Currently I have this:

VEHICLE_KMS2: IIf([VEHICLE_KMS]>999999,Left([VEHICLE_KMS],6),[VEHICLE_KMS])

What I need is to have it remain as a number, seems that the left function turns it into a string value.

Thanks
 
Just a quick thought, why not divide the number by 10 or 100 in your calculation.
 
Left() is a string function. String functions do not always work properly with numeric or date data since numeric data is not a string. ghudson't solution should solve your problem.
 
Changing to string and back should work as well :)

VEHICLE_KMS2: IIf([VEHICLE_KMS]>999999,clng(Left(cstr([VEHICLE_KMS]),6)),[VEHICLE_KMS])

Peter
 
Bat17 - String functions are NOT reliable when used on numeric fields. Read help if you don't believe me. If you insist on using string functions, convert the number to a string first, use the function, then convert it back.
 

Users who are viewing this thread

Back
Top Bottom