How do I default a field to calculate in update mode

G

Guest

I need one of the fields in my form to update automatically with a
calculation of 2 other fields in the form if either of the other 2 fields are
updated. Example:

3 fields are:
Frequency - Number field ( days )
LastSchedDate - Date field
NextSchedDate - to be updated to [Frequency] + [LastSchedDate] if either the
Frequency or LastSchedDate are updated
 
G

Guest

Set the control source property of your NextSchedDate box to
=DateAdd("d",[Frequency],[LastSchedDate])
 
J

John W. Vinson

I need one of the fields in my form to update automatically with a
calculation of 2 other fields in the form if either of the other 2 fields are
updated. Example:

3 fields are:
Frequency - Number field ( days )
LastSchedDate - Date field
NextSchedDate - to be updated to [Frequency] + [LastSchedDate] if either the
Frequency or LastSchedDate are updated

If you're storing NextSchedDate in your table - i.e. if the form control is
bound to a table field... DON'T.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.

John W. Vinson [MVP]
 
G

Guest

Hi Dennis,

Thank you - with your answer and John's I understand, I will now go change
my other sections behaviour.

Regards
Michelle


Dennis said:
Set the control source property of your NextSchedDate box to
=DateAdd("d",[Frequency],[LastSchedDate])

Michelle said:
I need one of the fields in my form to update automatically with a
calculation of 2 other fields in the form if either of the other 2 fields are
updated. Example:

3 fields are:
Frequency - Number field ( days )
LastSchedDate - Date field
NextSchedDate - to be updated to [Frequency] + [LastSchedDate] if either the
Frequency or LastSchedDate are updated
 
G

Guest

Hi John,

Thank you..With your answer along with Dennis I understand. Will now go
figure out the other sections that use this...
--
Regards
Michelle


John W. Vinson said:
I need one of the fields in my form to update automatically with a
calculation of 2 other fields in the form if either of the other 2 fields are
updated. Example:

3 fields are:
Frequency - Number field ( days )
LastSchedDate - Date field
NextSchedDate - to be updated to [Frequency] + [LastSchedDate] if either the
Frequency or LastSchedDate are updated

If you're storing NextSchedDate in your table - i.e. if the form control is
bound to a table field... DON'T.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or just as you're now doing it -
in the control source of a Form or a Report textbox.

John W. Vinson [MVP]
 

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