Dropping decimals

C

Chris

I created the following field in my query:

Years of Service: (DateDiff("d",dbo_HR_EMPLOYEES.SERVICE_DT,[Service to
Date? (MM/DD/YY):])/365)

I plug in an "as of" service date. I want the Years Of Service in whole
numbers to show up, but NOT rounded. For example if the years of service
are as follows

John Smith 15.33
Jane Doe 15.83

I would like the decimals to just drop off and see 15 for both....any ideas?

Thanks,
Chris
 
R

RobFMS

Here is some information straight from the Access help file:

This example illustrates how the Int and Fix functions return integer
portions of numbers. In the case of a negative number argument, the Int
function returns the first negative integer less than or equal to the
number; the Fix function returns the first negative integer greater than or
equal to the number.

Dim MyNumber
MyNumber = Int(99.8) ' Returns 99.
MyNumber = Fix(99.2) ' Returns 99.

MyNumber = Int(-99.8) ' Returns -100.
MyNumber = Fix(-99.8) ' Returns -99.

MyNumber = Int(-99.2) ' Returns -100.
MyNumber = Fix(-99.2) ' Returns -99.

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
C

Chris

This works great. I looked up truncate and rounding. I did not know to
look under Int.

Thanks
RobFMS said:
Here is some information straight from the Access help file:

This example illustrates how the Int and Fix functions return integer
portions of numbers. In the case of a negative number argument, the Int
function returns the first negative integer less than or equal to the
number; the Fix function returns the first negative integer greater than or
equal to the number.

Dim MyNumber
MyNumber = Int(99.8) ' Returns 99.
MyNumber = Fix(99.2) ' Returns 99.

MyNumber = Int(-99.8) ' Returns -100.
MyNumber = Fix(-99.8) ' Returns -99.

MyNumber = Int(-99.2) ' Returns -100.
MyNumber = Fix(-99.2) ' Returns -99.

HTH

--
Rob

FMS Professional Solutions Group
http://www.fmsinc.com/consulting

Software Tools for .NET, SQL Server, Visual Basic & Access
http://www.fmsinc.com

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Chris said:
I created the following field in my query:

Years of Service: (DateDiff("d",dbo_HR_EMPLOYEES.SERVICE_DT,[Service to
Date? (MM/DD/YY):])/365)

I plug in an "as of" service date. I want the Years Of Service in whole
numbers to show up, but NOT rounded. For example if the years of service
are as follows

John Smith 15.33
Jane Doe 15.83

I would like the decimals to just drop off and see 15 for both....any ideas?

Thanks,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top