textbox autopopulated with formula...

  • Thread starter Thread starter fossy
  • Start date Start date
F

fossy

Hello, I have a form (frmFINISHING) that it's record source is a table
(tbFINISHING). I have 4 fields: (Carton_Case), (Finish_Cases), (Odd_Count)
and (Total_Cartons). I need (Total_Cartons) to be autopopulated once the user
inputs the qunatities in hte other 3 fields, the formula would be something
like this:

(Total_cartons)=(Carton_case) x (Finish_Cases) + (Odd_Count).

I know this might seem like a 1st grade question, but i can't make it work.
Also, where would it be the best place to put the formula on? on the field
properties (table or form) or on a separate query Thanks in advance.
 
You can do it with a calculated field in a query or in an
unbound control on a form or report. You should not
try to store the value in your table, just calculate it on
the fly as needed.
 
Calculated values like you described should not be stored in a table.
If one of the underlying values that the calculation is based on gets
changed, the stored value is NOT automatically recalculated, so you
can end up with data in your table which is wrong!

Calculated values like this should be done in queries/forms/reports. If
you create a query that includes all the fields from your table plus
a calculated field like;

TotalCartons: [Carton_Case]*[Finish_Cases]+[Odd_Count]

you can then use that query (instead of the table) as the record source
of a form or report. You can have a text box bound to that calculated
field just as if it were a field in a table, without the inherent drawbacks
of
storing a calculated value in a table.

_________

Sean Bailey
 
Back
Top