Access specific Round Down function

L

Lucky

I need to create an Access only Round Down function.
This function must round down every number. Therefore,
if the number is 9.031 or 9.99949 the result still must
be 9.

I have been using Excel RoundDown function, but the
queries are becoming rather large and this function slows
down the processing intolerably.

Here is the function I have used:

Function xlRoundDown(dblNumber As Double) As Long
'Round number down using Excel RounDown function
Dim objExcel As Excel.Application

Set objExcel = CreateObject("Excel.Application")
xlRoundDown = objExcel.Application.RoundDown
(dblNumber, 0)

objExcel.Quit
Set objExcel = Nothing
End Function

I am familiar with Microsoft Knowledge Base Article
209996, but it does not do the trick.

Any help is greatly appreciated.

Lucky
 
B

Brian Camire

You might try using the built-in Int or Fix functions. They would round
down both 9.031 and 9.99949 to 9. They differ in how they handle negative
numbers. Int rounds (truncates) away from zero, and Fix rounds (truncates)
towards zero. For example:

Int(-9.031) would return - 10

where as

Fix(-9.031) would return 9.
 

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