Round() Function

J

Justin

I'm trying to use the round function along with an user supplied value to
control the form display. An engineer will supply a part attribute, spec
range and and integer value for the number of decimals to display. I use
this integer number when data is enetered by production workers. For example:

diameter specmin: 2, specamx: 4, specdisplay: 3, actualval: 3.14
length specmin: 10, specmax: 12, specdisplay:2 , actualval: 11.159

Currently I'm using the following formula to display

ROUND([actualval],Nz([specdisplay],0))

This works for some data but not all. Some records are displayed with a
large stream of decimals. This happens even when I substitue the
[specdisplay] for an actual number. Is there something about the ROUND
function I'm missing?

Also I want to be able to force the number of decimals diplayed to be equal
to [specdispaly]. So if [specdisplay] = 3 and [actualval] = 0.8 I want the
display to be 0.800.
Is there another function I should be using?
 
M

Mark A. Sam

Justin,

Try the Format() function
Format(<xpression>,"0.00")

So if your expression is working it would be,

Format(ROUND([actualval],Nz([specdisplay],0)),"0.00")

God Bless,

Mark A. Sam
 
J

John W. Vinson

Justin,

Try the Format() function
Format(<xpression>,"0.00")

So if your expression is working it would be,

Format(ROUND([actualval],Nz([specdisplay],0)),"0.00")

Just note that the Format() function returns a String, not a number value - if
you're going to do further calculations this can cause more complexity. Access
will convert back to number if needed but it's an extra step.
 

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