Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Milliseconds

19 views
Skip to first unread message

may...@msn.com

unread,
Jul 21, 2006, 2:47:25 PM7/21/06
to
I looking for some help in completing the code below for use within an
access app. I currently attach my database to an application which
stores a swimmer's time. The problem I'm having is that the the
swimmer's time within the table displays 67.62 seconds. The code below
modifies this to read 00:01:08:00. I'm hoping someone could help with
getting the code to display 00:01:07.62

Public Function TimerStuff(TimeElapsed As Double) As String
Dim Seconds As Double
Dim Minutes As Double
Dim Hours As Double
Dim A As String
'Find The Seconds
Seconds = TimeElapsed Mod 60
'Find The Minutes
Minutes = (TimeElapsed \ 60) Mod 60
'Find The Hours
Hours = (TimeElapsed \ 3600)
'Format The Time
If Hours >= 0 Then
A = Format(Hours, "00") & ":"
End If
A = Format(Hours, "00") & ":"
A = A & Format(Minutes, "00") & ":"
A = A & Format(Seconds, "00.00")
TimerStuff = A
End Function

CDMAP...@fortunejames.com

unread,
Jul 21, 2006, 3:24:32 PM7/21/06
to

Here's how I might try it (air code):

'Begin Module Code-------
Type SwimTime
Hours As Integer
Minutes As Integer
Seconds As Double
End Type

Public Function FormatSwimTime(theSwimTime As SwimTime) As String
FormatSwimTime = Format(theSwimTime.Hours, "00") & ":" &
Format(theSwimTime.Minutes, "00") & ":" & Format(theSwimTime.Seconds,
"00.00")
End Function
'End Module Code------------

Then in your function:

Dim ASwimTime As SwimTime
...
Seconds = TimeElapsed - 60 * Int(TimeElasped / 60)
...
ASwimTime.Hours = Hours
ASwimTime.Minutes = Minutes
ASwimTime.Seconds = Seconds
TimerStuff = FormatSwimTime(ASwimTime)
End Function

Actually, the 'Seconds = TimeElapsed - 60 * Int(TimeElasped / 60)' part
is probably all you really need to make your code work.

James A. Fortune
CDMAP...@FortuneJames.com

0 new messages