Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncate - Not round 1

Status
Not open for further replies.

adrikev

Programmer
May 17, 2002
36
0
0
US
I'm trying to truncate the decimals from a calculation that I'm making in a query. I have the following function but it returns 0 (zero) for all of my values.
Code:
Public Function RndDn(MyNum As Double) As Integer

    Dim lngResult As Long

    lngResult = Int(MyNum)
    MyNum = lngResult

End Function
The expression in my query is as follows:
Code:
Send_Back_Qty: RndDn(IIf([WOH]>10,[OHB]-[AvgStoreSales]*10,0))
For example:
WOH = 82.33
OHB = 19
AvgStoreSales = .2307

The calculated value before using the RndDn function is 16.693
I want the value to be 16

When I added the RndDn function it is returning 0 (zero)

Any thoughts?, comments? --------------------------------
Fortius, Citius, nullis secundus
Strength, Speed, second to none
 
If you always want to round down, just rap your expression in the Int() function
Int(IIf([WOH]>10,[OHB]-[AvgStoreSales]*10,0))

Paul

 
Ahhh, I'm a bone-head. Thanks Paul --------------------------------
Fortius, Citius, nullis secundus
Strength, Speed, second to none
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top