passing the value from function into table's field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I found on Microsoft website a function call ElapsedTimeString that
calculates the value between two dates and displays the difference in XX
days, XX hours, XX minutes, XX seconds format. According to the web site
instruction to call this function I should place
=ElapsedTimeString([Open Date],[Time Closed]) in control source of my text
box.
Function is working ok, but I would like to pass the result into field in my
table call TimeDiffrece. Any idea how to do it?
Thanks
 
In a nutshell, you shouldn't. Calculated values should not be stored in
tables. They should only appear in your querys, forms and reports
 
Function is working ok, but I would like to pass the result into field in my
table call TimeDiffrece. Any idea how to do it?

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. In a Query,
just type TimeDiff: ElapsedTimeString([Open Date],[Time Closed]) in a vacant
Field cell; you already have it for the control source of a textbox.


John W. Vinson [MVP]
 
Back
Top