After Update action

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

Guest

I have a form linked to a table that has a couple of 'after update' actions.
There is a release time field (date/time, short time format, input mask 00:00)
and
a time in field (date/time format, short time format,)
and
a total time taken field (Date/Time, no format)

There is also a distance field (in yards)

The purpose is to calculate the total time taken and speed in yards per
minute.

A friend created some Vb as follows -

Private Sub Time_In_AfterUpdate()

Me.Total_Time_Taken = Me.Time_In - Me.Release_Time
Me.Speed_in_Yds_Min = Me.Distance_in_Yards / Me.Total_Time_Taken
End Sub

The problem I have is that the calculated time (total time taken field) is
in hours and mins

How can I make this field show in total minutes instead of hours and minutes?

Thanks
 
Sorry Al - my code knowledge isn't that good although the page is very
informative. I wasn't sure which part of the guide was supposed to be
inserted where in my VB statement.
 
RC,
Hang on, and I'll try to get back to you on that...
It's do-able...
 
RC,
This should do it. *I'm assuming your Speed_in_Yards_Min calculation
was correct.*
(Make TotalTime a text field...)

Private Sub Time_In_AfterUpdate()
Me.Total_Time_Taken = Int(DateDiff("n", [Time1], [Time2]) / 60) & " Hrs
" & DateDiff("n",[Time1],[Time2]) Mod 60 & " Secs"
Me.Speed_in_Yds_Min = Me.Distance_in_Yards / (Me.Time_In -
Me.Release_Time)
End Sub

Using 9:00am to 10:17am and 30,000 yards
TotalTime = "1 Hrs 17 Mins"
Speed_In_Yards_Min = 389.61
 
Many thanks for making it it clear for me - much appreciated.

Ron

Al Camp said:
RC,
This should do it. *I'm assuming your Speed_in_Yards_Min calculation
was correct.*
(Make TotalTime a text field...)

Private Sub Time_In_AfterUpdate()
Me.Total_Time_Taken = Int(DateDiff("n", [Time1], [Time2]) / 60) & " Hrs
" & DateDiff("n",[Time1],[Time2]) Mod 60 & " Secs"
Me.Speed_in_Yds_Min = Me.Distance_in_Yards / (Me.Time_In -
Me.Release_Time)
End Sub

Using 9:00am to 10:17am and 30,000 yards
TotalTime = "1 Hrs 17 Mins"
Speed_In_Yards_Min = 389.61
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


RC said:
Sorry Al - my code knowledge isn't that good although the page is very
informative. I wasn't sure which part of the guide was supposed to be
inserted where in my VB statement.
 

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

Back
Top