Access specific Round Down function

  • Thread starter Thread starter Lucky
  • Start date Start date
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
 
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.
 
Back
Top