Calculated control & bound control?

G

Guest

Is it possible to have a calculated control on a form that is bound to a
particular field in a table or do calculated controls on a form always have
to be unbound?

Thanks.
 
T

tina

a bound control is called "bound" because its' ControlSource property is set
to the name of a field included in the form's RecordSource. a calculated
control is called that because its' ControlSource property is set to an
expression or a value - it "equals" (=) something. since a control has only
one ControlSource property, the bound and unbound states are mutually
exclusive.

you *can* save the value of a calculated control into a form's underlying
table. include the field you want to save the value into, in the form's
RecordSource. add code (in the form's BeforeUpdate event, for instance) to
set the value of the field to equal the value of the calculated control, as

Me.FieldName = Me!ControlName

beyond that, take a moment to consider whether or not you *should* save a
calculated value into a table. the rule of thumb is that the raw data that
is needed to calculate a value is saved in a table, and the calculation is
*not* saved, but is performed on-the-fly whenever it's needed in a query,
form, or report.

hth
 
T

Tom Lake

PRH said:
Is it possible to have a calculated control on a form that is bound to a
particular field in a table or do calculated controls on a form always
have
to be unbound?

If you can calculate a value on the fly, why would you want to store it in a
table? There ARE some examples where you would but most of the time,
careful examination of the problem shows that not to be necessary. I do
like to store rates in transaction table after finding them in a rate table
because
if the rate table changes, I still want a historical record of what rate was
used in the initial calculation.

Tom Lake
 

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