View Full Version : rounding off


sassenach
05-11-2003, 04:02 AM
hi,

In my reports, I have an order form.
In the order form I have a calculated total of the products the user bought. I would like to round off all of the products to two decimal points, but i want them to be .00.
example:

127.64
+34.22
=
162.00

how do i go about doing this?

thanks

Fuga
05-11-2003, 05:12 AM
You can use the int() function to return only the integer portion of the numbers.

However, I think this meens that 3,8 will be returned as 3. To solve this, you can first add 0,5 to the numbers, like this:

3,8 + 0,5 = 4,3

Int(4,3) = 4

whereas:

3,3 + 0,5 = 3,8

int(3,8) = 3

Now I havenīt done this for a while, so I suggest you look up the int() function in help for the syntax.

Or maybe there is a better way. I use A97, maybe later versions has a built in funtion.

Fuga.

sassenach
05-11-2003, 01:28 PM
fuga,

i am not so familar with where to put these function (such as int() ) so if you can be more specific. that would be great.
i did a search in ms access (xp) but nothing really showed up on this function. the only thing i received is how to choose how many decimal points.
thanks
meytal

jbg
05-12-2003, 07:01 AM
I'm relatively new to this, but you could always consider rounding to a whole number then concatenating the ".00"

ex: Round(number,0) & ".00"

sassenach
05-13-2003, 06:23 AM
do i write this in the input mask?

jbg
05-13-2003, 06:37 AM
Actually I just tried it and it didn't work out right. However, there is an even easier solution....

Just use the round function to round off the sum of the numbers to be calculated

ex: Round(thenumber,0)

Then set the format to "fixed" and the number of decimals to 2