Rounding up with a values lower than 4 set to 4

JLAZ

Registered User.
Local time
Today, 08:30
Joined
Sep 17, 2003
Messages
24
I'm Using this function to round up

Function roundup(pNum As Double) As Integer
roundup = IIf(pNum > Int(pNum), Int(pNum) + 1, pNum)
End Function
--------------------------------------------------------------------------------


test it from the debug window with

? roundup(15.01)
16

your text-box Control Source would be something like:

= roundup([myField])

I need to have values lower than 4 become 4

what do I need to do
 
How about this:
Code:
Function roundup(pNum As Double) As Integer 
  If pNum < 4 Then
    roundup = 4
    Exit Function
  End If
roundup = IIf(pNum > Int(pNum), Int(pNum) + 1, pNum) 
End Function
 
Thanks it worked great
:D
 

Users who are viewing this thread

Back
Top Bottom