This topic is locked

Adding Time Fields

5/26/2007 6:54:32 PM
ASPRunnerPro General questions
G
grinningdog author

I've got some fields that I have calculated times in by using

Function BeforeEdit(dict, where)
if dict("Start")<>"" and dict("Finish")<>"" then

intT1 = dict("Start")
intT2 = dict("Finish")
d1= CDate(intT1)
d2= CDate(intT2)
d3 = DateDiff("s",d1,d2)
d = d3 \ 3600 & ":" & (d3 Mod 3600) \ 60 & ":" & d3 Mod 60
dict("Total1") = d

end if

BeforeEdit = True


but then, as part of the same before add function, I want to calculate other fields based on those results
For example I want to say

dict("SplitTimes")= dict("Run")+dict("Bike")+dict("Swim")
and
dict("OverallTime")= dict("SplitTimes")+dict("Penalties")


What's the best way to achieve that?

J
Jane 5/28/2007

Just add your code to the event:

Function BeforeEdit(dict, where)

if dict("Start")<>"" and dict("Finish")<>"" then

intT1 = dict("Start")
intT2 = dict("Finish")
d1= CDate(intT1)
d2= CDate(intT2)
d3 = DateDiff("s",d1,d2)
d = d3 \ 3600 & ":" & (d3 Mod 3600) \ 60 & ":" & d3 Mod 60
dict("Total1") = d

end if

dict("SplitTimes")= CDate(dict("Run"))+CDate(dict("Bike"))+CDate(dict("Swim"))
dict("OverallTime")= CDate(dict("SplitTimes"))+CDate(dict("Penalties"))



BeforeEdit = True