My Assistant
|
|
Apr 29 2010, 09:41 AM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 74 From: Indiana |
I know this is another of those elementary things I am just missing.
In the detail section of my report I have a field [Duration]. Duration represents seconds. In the report footer I have a the sum of Duration, or =Sum([Duration]). I would like to add in the Detail section of the report an expression which will take [Duration] and convert it to hh/mm/ss. I would like to add in the Report Footer section of the report an expression which will take my sum of [Duration] and convert it to hh/mm/ss.... keeping in mind, this may be over 24 hours. Suggestions? |
|
|
|
![]() |
Apr 29 2010, 10:26 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,730 From: Carrollton, TX |
I wanted the excercise and came up with this duration function:
CODE Public Function MyDuration(MySeconds As Long) As String
Dim iHours As Long Dim iMinutes As Integer Dim iSeconds As Integer iHours = Fix(MySeconds / 3600) iMinutes = Fix((MySeconds - (iHours * 3600)) / 60) iSeconds = (MySeconds - (iHours * 3600)) - (iMinutes * 60) If iHours > 0 Then MyDuration = CStr(iHours) & ":" Else MyDuration = "0:" End If If iMinutes > 0 Then MyDuration = MyDuration & Right("0" & CStr(iMinutes) & ":", 3) Else MyDuration = MyDuration & "00:" End If If iSeconds > 0 Then MyDuration = MyDuration & Right("0" & CStr(iSeconds), 2) Else MyDuration = MyDuration & "00" End If End Function |
|
|
|
Apr 29 2010, 12:28 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 74 From: Indiana |
I wanted the excercise and came up with this duration function: CODE Public Function MyDuration(MySeconds As Long) As String Dim iHours As Long Dim iMinutes As Integer Dim iSeconds As Integer iHours = Fix(MySeconds / 3600) iMinutes = Fix((MySeconds - (iHours * 3600)) / 60) iSeconds = (MySeconds - (iHours * 3600)) - (iMinutes * 60) If iHours > 0 Then MyDuration = CStr(iHours) & ":" Else MyDuration = "0:" End If If iMinutes > 0 Then MyDuration = MyDuration & Right("0" & CStr(iMinutes) & ":", 3) Else MyDuration = MyDuration & "00:" End If If iSeconds > 0 Then MyDuration = MyDuration & Right("0" & CStr(iSeconds), 2) Else MyDuration = MyDuration & "00" End If End Function I used this one. Thank you to all. I created a module and named it Mod_MyDuration. This was a great find! Thank you. This piece of code is going in my collection. |
|
|
|
danbouton Converting Seconds, Summing Apr 29 2010, 09:41 AM
RAZMaddaz Here is a Link to a Microsoft Function called ... Apr 29 2010, 10:20 AM
doctor9 Apparently it's a slow day here at UA. He... Apr 29 2010, 10:28 AM
theDBguy Hi All,
Sounds like fun. Here's my "lazy... Apr 29 2010, 12:11 PM
danbouton QUOTE (theDBguy @ Apr 29 2010, 01:11 PM) ... Apr 29 2010, 12:29 PM
theDBguy QUOTE (danbouton @ Apr 29 2010, 10:29 AM)... Apr 29 2010, 12:54 PM
RAZMaddaz RE: Converting Seconds, Summing Apr 29 2010, 12:31 PM
rbianco While I "technically may have "won... Apr 29 2010, 01:14 PM
theDBguy QUOTE (rbianco @ Apr 29 2010, 11:14 AM) W... Apr 29 2010, 01:22 PM![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 26th May 2013 - 02:18 AM |