View Full Version : Rounding Down
JoeShmoe
11-15-2007, 07:54 PM
Basically i've made a Select statement with cases like 0,1,2,3 ect. The problem is the thing im checking is often a decimal number.. how would i go about rounding it down no matter what the decimal?
Thanks in advance.
asingh
11-16-2007, 02:49 AM
SELECT Int([Table1]![num]) AS num_int FROM Table1
where..num is my decimal number I am typecasting it into an integer
OTWarrior
11-16-2007, 08:05 AM
doesn't "Int" round up though?
akn112
11-16-2007, 08:28 AM
I believe changing it to an int concatenates everything to the left of the decimal place. so it rounds down
OTWarrior
11-16-2007, 09:09 AM
Yep just tested it.
it does round down, my bad.
TonyJollans
11-19-2007, 11:32 AM
Yes ..
Int returns the Integer part of a number
CInt converts it to an integer (and rounds it in the process)
DarkSprout
11-20-2007, 06:06 AM
Place this in a module, and use instead of CInt or Int
Public Function DInt(n As Single) As Long
'returns only the value left of the decimal point
DInt = Left(Trim(str(n)), InStrRev(Trim(str(n)), "."))
End Function
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.