Rounding anomoly

  • Thread starter rwboyden via AccessMonster.com
  • Start date
R

rwboyden via AccessMonster.com

In a report, a control with a souce using Round(number, 2)*100 produces the
correctly rounded figure (a percentage) on my machine (XP Access 2003) but
the unrounded figure on a client machine (also XP Access 2003). Any idea why
this might happen?
 
A

Allen Browne

There may be a different version of some library on the other PC, or it may
be a floating point issue, or (most likely) a difference in the way the data
type is being interpreted.)

Whatever the cause, you could probably work around it by multiplying by 100
first, and then rounding. Since you want an integer, I suggest you use
CInt() unless you need to return some Null values.

Try:
CInt(IIf([num] Is Null, 0, [num] * 100))
 
R

rwboyden via AccessMonster.com

Allen said:
There may be a different version of some library on the other PC, or it may
be a floating point issue, or (most likely) a difference in the way the data
type is being interpreted.)

Whatever the cause, you could probably work around it by multiplying by 100
first, and then rounding. Since you want an integer, I suggest you use
CInt() unless you need to return some Null values.

Try:
CInt(IIf([num] Is Null, 0, [num] * 100))
In a report, a control with a souce using Round(number, 2)*100 produces
thecorrectly rounded figure (a percentage) on my machine (XP Access
2003) but the unrounded figure on a client machine (also XP Access 2003).
Any idea why this might happen?
Allen - Thanks ... Problem solved!
 

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

Top