Entry of Calculated Values in Form

  • Thread starter Thread starter DBF
  • Start date Start date
D

DBF

Can anyone help?
I am building a database and have not been able to find a
way to enter a calculated value into a field.

For instance:

Field names [Unit Cost], [Qty], and [Total Cost]

[Total Cost]= [Qty]*[Unit Cost]

On the form for Total Cost I have entered the expression
[Qty]*[Unit Cost] and the value is displayed correctly.
But the value is not saved into the Total Cost field in
the table.
I have various expression options but without success.
I am sure there is a simple solution as this seems a
reasonable requirement.
Can anyone suggest a solution?

Many thanks DBF
 
In order to store the value to the table field, you need to make sure the
control (Total Cost) is bound to the tabkle field. My guess is it is not. To
verify / fix, open the form in design view, select the control, open the
properties window and check the value of ControlSource property on the Data
field; it should have the name of the total value field in your table. If
not, select it from the drop-down list and save.

This is the general concept for storing a calculated value in a table field.
You need to ask yourself, though, whether you actually need to do that. If
the quantity and unit cost are stored already, then you can easily
re-calculate your total cost anytime, instead of saving redundant data.

HTH,
Nikos
 
Many thanks for your prompt reply.
Understood solution but where does the calculation /
expression go?
DBF
-----Original Message-----
In order to store the value to the table field, you need to make sure the
control (Total Cost) is bound to the tabkle field. My guess is it is not. To
verify / fix, open the form in design view, select the control, open the
properties window and check the value of ControlSource property on the Data
field; it should have the name of the total value field in your table. If
not, select it from the drop-down list and save.

This is the general concept for storing a calculated value in a table field.
You need to ask yourself, though, whether you actually need to do that. If
the quantity and unit cost are stored already, then you can easily
re-calculate your total cost anytime, instead of saving redundant data.

HTH,
Nikos


Can anyone help?
I am building a database and have not been able to find a
way to enter a calculated value into a field.

For instance:

Field names [Unit Cost], [Qty], and [Total Cost]

[Total Cost]= [Qty]*[Unit Cost]

On the form for Total Cost I have entered the expression
[Qty]*[Unit Cost] and the value is displayed correctly.
But the value is not saved into the Total Cost field in
the table.
I have various expression options but without success.
I am sure there is a simple solution as this seems a
reasonable requirement.
Can anyone suggest a solution?

Many thanks DBF


.
 
Many thanks for your prompt reply.
Understood solution but where does the calculation /
expression go?
DBF
-----Original Message-----
In order to store the value to the table field, you need to make sure the
control (Total Cost) is bound to the tabkle field. My guess is it is not. To
verify / fix, open the form in design view, select the control, open the
properties window and check the value of ControlSource property on the Data
field; it should have the name of the total value field in your table. If
not, select it from the drop-down list and save.

This is the general concept for storing a calculated value in a table field.
You need to ask yourself, though, whether you actually need to do that. If
the quantity and unit cost are stored already, then you can easily
re-calculate your total cost anytime, instead of saving redundant data.

HTH,
Nikos


Can anyone help?
I am building a database and have not been able to find a
way to enter a calculated value into a field.

For instance:

Field names [Unit Cost], [Qty], and [Total Cost]

[Total Cost]= [Qty]*[Unit Cost]

On the form for Total Cost I have entered the expression
[Qty]*[Unit Cost] and the value is displayed correctly.
But the value is not saved into the Total Cost field in
the table.
I have various expression options but without success.
I am sure there is a simple solution as this seems a
reasonable requirement.
Can anyone suggest a solution?

Many thanks DBF


.

The calculation goes into the control source of an UNBOUND control.
Set it's control source to:
= [Qty]*[Unit Cost]
You may name this control "TotalCost".

But do not save this result in any table.
It is redundant data.
Remove the [TotalCost] field from your table.
Whenever you need the TotalCost, recalculate it, using the same
expression.
 
Back
Top