Access SQL: trimming data

P

Pharoh

If one column in a table has a value of 23:45.99 how can I cut off
everything after the decimal if it's greater than .00?
 
J

Jeff Boyce

Pharoh

If you actually had a number, you could convert it to an integer to get rid
of everything to the right of the decimal place. But "23:45.99" is a text
string.

If you are using it as a number, Access doesn't know that. You may have to
"parse" it and convert it to an actual number before you can truncate (or
round, or ...) it.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Douglas J. Steele

As Jeff points out, 23:45.99 is a string, not a number, so you can use
string functions on it:

Left("23:45.99", InStr("23:45.99", ".") - 1)
 
Top