Sums and decimals

C

Cornish Teeth

I am new to Access and trying to figure out somehthing that is probably a simple thing. On a form, I have 4 inputs that denote downtime for a machine that I am running (DT SETUP, DT MAINT, DT ELEC, DT REG). I want to tally the total, show it on the form, and also put the amount in my table under TOTAL DOWNTIME for later "querying." The problem that I am having is that I can get it to total on the form using the formula below. The formula is placed in the Control Source of my TOTAL DOWNTIME info. Once it tallies the total, why can I get it to go to the table under TOTAL DOWNTIME. What am I missing?

=Sum([DT SETUP]+[DT MAINT]+[DT ELEC]+[DT REG])

Another thing is the problem with decimal placement. In each of those 4 inputs I need the number to be in decimal format (ex. 1.25) I type 1.25 and the form displays 2.00. Why

If someone needs my database to view, please just ask

V/R
Cornish Teet
 
K

Ken Snell

Are the textboxes that are showing the "2.00" bound to fields in the form's
record source? And are those fields set to Numeric / Long Integer (or
Integer) format? The Long Integer is the default setting when you create a
Numeric field; you must change it to Single or Double if you want to store
decimal values.

Regarding the storage of the calculated number: If you're already storing
the individual inputs (DT SETUP, DT MAINT, DT ELEC, DT REG) then you don't
need (in most cases) to store their sum too...you simply recalculate the sum
using a query whenever you want to display or use it.

A control can have either an expression (such as your "=Sum([DT SETUP]+[DT
MAINT]+[DT ELEC]+[DT REG])") or a field name in it; you cannot have both.
Thus, if a control has an expression in its control source, that control
cannot be bound to a field. You must use another control that is bound to
the field, and then use programming to write the value into that textbox
from the calculated control.

However, I believe in your case that you should not be storing the sum, so
such programming shouldn't be needed. Post back if you have more questions
about this or need additional clarification.

--
Ken Snell
<MS ACCESS MVP>

Cornish Teeth said:
I am new to Access and trying to figure out somehthing that is probably a
simple thing. On a form, I have 4 inputs that denote downtime for a machine
that I am running (DT SETUP, DT MAINT, DT ELEC, DT REG). I want to tally the
total, show it on the form, and also put the amount in my table under TOTAL
DOWNTIME for later "querying." The problem that I am having is that I can
get it to total on the form using the formula below. The formula is placed
in the Control Source of my TOTAL DOWNTIME info. Once it tallies the total,
why can I get it to go to the table under TOTAL DOWNTIME. What am I missing?
=Sum([DT SETUP]+[DT MAINT]+[DT ELEC]+[DT REG])

Another thing is the problem with decimal placement. In each of those 4
inputs I need the number to be in decimal format (ex. 1.25) I type 1.25 and
the form displays 2.00. Why?
 

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