Fields format

G

Guest

I have some fields in a table which store calculation results. I use update
query to update the fields. The calculation formula likes this: A*B/C. The
problem is if the feilds type in the table is Number, format is fixed and
Decimal places is in 2, after update, the data like this: 234.00, 33.00. The
real results should be 234.67, 33.55. If the fields type in table is text.
after update, the data like this, 234.6712, 33.5468. We I use these fields to
create a report, I can't let the data show in 2 digit decimal,
no metter I set the format in fixed, decimal places is in 2. The data alweys
show 4 or decimal.
 
N

Nikos Yannacopoulos

You are losing the decimal part because you have selected (or Access has
defaulted in) an integer field size (either Integer or Long). You need
to change that setting to Double.

By the way, if you can calculate the value so easily from data that is
already there, in principle you should not store the calculation result,
you should just recalculate whenever required. Storing is required only
if the calculation is based on temporary data that will not be available
in the future.

HTH,
Nikos
 
R

Rick B

Redwood:

why are you storing a calculated result in a table? Your value will only be
correct as of the last time you ran your update query.

Instead, just calculate it in your queries, reports, and forms.
 
G

Guest

Thank you very much for your help. I get it.

Thank you very much for the tip, Rick. I understant your means. I used to
not do like that. This time I need to store the calculation data into the
table because somebody wants me to calculate it and put it in the table, so
they can easily pull out the data from the table and look at or perform the
analysis whatever they want.
 
R

Rick B

Hmmm. That still is not a reason to store it. They can use a query instead
of a table. Just create a query for them.
 

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