Issues with Rounding (or lack thereof)

G

Garret

Hello, I've got a question with an Access 2000 Database.

I've got a query with a calculated field: Der_Percent_Good.

Der_Percent_Good: Nz((100*(1-[Num_Out_Tol]/[Shipment_Sample_Size])),"N/
A")

This field is supposed to be a percentage, and I'd like this field to
be able to round to 2 decimal places, for right now it does not.
Right now it has a large amount of decimal places if the situation
arises, like 1/3 (goes out of view on my textbox on the form), and it
will have 0 decimal places if it turns out to be a whole number
(0/100).

I've tried selecting Properties->Format-> Fixed (and Percent)...which
did not work.

I've also tried changing the actual text box on the form that displays
this field, and setting the Decimal places property to 2...and that
did not work either.

Any other suggestions?
 
G

Guest

Hi

The use of the Nz function here is causing the field to be treated as text
so any numeric format isn't giving the expected results.

Try the following calculation...

Der_Percent_Good: 100*(1-[Num_Out_Tol]/[Shipment_Sample_Size])

and then set the Format in the form to something like...

0.00;-0.00;0.00;"N/A"

The 4th parameter here is displayed when the value is Null.

Hope this helps

Andy Hull
 

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

Similar Threads


Top