how do I round up in access 2000

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I force Acces to always round up instead of rounding to the nearest
integer?
For example, Access rounds 4.3 to 4. I would like it to round up to 5.

Any help would be appreciated.

Thank you,
Miriam
 
You will have to write your own function and then add to your control an
AfterUpdate event procedure; a function like:

Function RoundUp(X, D As Integer) ' Where X is the number to round up an D
is number of digits (1 is no digits, 10 one digit,.....)
If IsNull(X) Then
RoundUp = Null
Else
RoundUp = CCur(Int(X * D + 0.999999999) / D)
End If
End Function

then in the AfterUpdate event procedure write something like this:

Me.NumValue=RoundUp(Me.NumValue,1)

If you do not know how to write Event Procedures, refer to your Access help
files
 
Use the expression:

- Int(-[YourNumber])

For example, from Debug window:

?-Int(-4.3)
5
 

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

Back
Top