rounding question

  • Thread starter Slez via AccessMonster.com
  • Start date
S

Slez via AccessMonster.com

I realize that there have been many previous postings on this topic, and I
have viewed a number of them, but haven't found one that helps me understand
this.

When I set the control source of a control on a report to: =Sum(Round(
[MachHrs])) , it yields a total of 28 when if you add the detail up, you get
a total of 29.577. By my standards that should round to 30.

I had the Decimal Places set to 0 before I added "Round" to the expression,
but that doesn't seem to have any affect. Ultimately, I'd be happy if it
just dropped the decimal places in the total of the report. Is there any
other way to accomplish this?

Any feedback is appreciated!
 
M

Marshall Barton

Slez said:
I realize that there have been many previous postings on this topic, and I
have viewed a number of them, but haven't found one that helps me understand
this.

When I set the control source of a control on a report to: =Sum(Round(
[MachHrs])) , it yields a total of 28 when if you add the detail up, you get
a total of 29.577. By my standards that should round to 30.

I had the Decimal Places set to 0 before I added "Round" to the expression,
but that doesn't seem to have any affect. Ultimately, I'd be happy if it
just dropped the decimal places in the total of the report. Is there any
other way to accomplish this?


Be careful with round, it does not distribute across the +
operator (as multiply does). That means that:
Round(X) + Round(Y) is not the same as Round(X + Y)

Without knowing what else you have going on, I suggest you
try using:
=Round(Sum(MachHrs))
 
Top