An,
In this case, you would not need to save the difference between the Start
and Finish.
Since you have a Start and Finish saved to the table, you would just need
to recalculate the difference "on the fly" in any subsequent Form, Query, or
Report... just the way you did on the original form...
= Start - Finish
For example, if you had
Price * Qty = LineTotal
you would not save the LineTotal, but reclaculate it from Price * Qty
whenever needed.
As a general rule... don't save a value in a table that can be re-derived
from already saved values.
Now... if you "must" save the difference, then add a field to your table
called, for example, [TimeDiff]. Place a text control on the form, with a
ControlSource of TimeDiff, and use the AfterUpdate event of both Start and
Finish to trigger this code...
Private Sub Start_AfterUpdate()
Me.TimeDiff = Start-Finish
End Sub
and...
Private Sub Finish_AfterUpdate()
Me.TimeDiff = Start-Finish
End Sub
If either Start or Finish change, the saved TimeDiff will be updated.
--
hth
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html
"Find a job that you love, and you'll never work a day in your life."
an said:
Hi!
I have a form (based in T_Table) with a Start textbox (Date/Time field), a
Finish texbox (Date/Time field) and a 3rd textbox with =[Start]-[Finish]
in
Control Source to show us the period between Start and Finish.
I would like help to after update put this result in my T_Table Period
field.
Thanks in advance.
an