Problems with decimals

P

Paul

I have created an update query which updates a table with
the result of a calculation , the field in the table that
stores the calculation is to 9 decimal places despite me
putting its format as standard to 2 decimal places in the
table.

This is therefore creating problems when I try and match
data to this field
Any ideas how I can prevent this?
 
D

Dirk Goldgar

Paul said:
I have created an update query which updates a table with
the result of a calculation , the field in the table that
stores the calculation is to 9 decimal places despite me
putting its format as standard to 2 decimal places in the
table.

This is therefore creating problems when I try and match
data to this field
Any ideas how I can prevent this?

The Format and Decimal Places properties only control how the field's
value is displayed, not what it actually contains. You'll need to round
the result of the calculation to the desired number of decimal places
before storing it in the field. For example, if before you had an
update query like this:

UPDATE MyTable
SET MyField = 123 / 456;

you should change it to

UPDATE MyTable
SET MyField = Round(123 / 456, 2);
 

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