Always Round Down

N

Nigel

I have a field on a report that whne it prints if it is 3 decimal places ie
36.175 I want it to round down to 36.17, if it is 2 or less decimla places
remain at that value,

any suggestions

field name is tipsize


thanks
 
N

Nigel

error message is


compile error

expected identifier and it highlights the int word

Int(100 * [Reports![Work Order]!wodetail.Report!tipsize]) / 100
 
N

Nigel

but this one I am stuck with

Reports![Work Order]!wodetail.Report!tipsize = Int(100 * Reports![Work
Order]!wodetail.Report!tipsize) / 100


tells me I can't assign a value to this object
 
B

BruceM

I was going to recommend something of the sort, but I tested first and
discovered what may be some floating point difficulties. For instance, I
type this into the immediate window:
?Int(100 * 3.76 / 100
but it returns 3.75. If I use 3.75 or 3.77 I get the correct result. 7.1
returns 7.09. It seems to work correctly in all cases for three decimal
places. I mention this because the OP wants the value to remain as it is if
there are two decimal places or less.
If this is a currency field, I don't think there is a problem. If it is a
single or double, some workaround seems to be needed. I have discovered
that formatting the value as currency works, as does adding .001 to the
value. There may be other approaches that work better.
 
A

Allen Browne

No code needed.

Just add a text box with Control Source:
= Int(100 * [tipsize]) / 100

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Nigel said:
but this one I am stuck with

Reports![Work Order]!wodetail.Report!tipsize = Int(100 * Reports![Work
Order]!wodetail.Report!tipsize) / 100

tells me I can't assign a value to this object
 

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