D
Denny G.
In a bound report, I have two bound controls (names: txtEndTime &
txtStartTime) and an unbound calculated control (txtElapsedTime). The two
bound controls have General Date as their format property. The unbound
calculated control's Control Source contains:
"GetElapsedTime([txtEndTime]-[txtStartTime])" (W/O quotes) from the
GetElapsedTime() function attached to the report, as follows:
Option Explicit
Function GetElapsedTime(interval)
Dim totalhours As Long, totalminutes As Long, totalseconds As Long
Dim days As Long, hours As Long, Minutes As Long, Seconds As Long
days = Int(CSng(interval))
totalhours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
totalseconds = Int(CSng(interval * 86400))
hours = totalhours Mod 24
Minutes = totalminutes Mod 60
Seconds = totalseconds Mod 60
GetElapsedTime = days & " Days " & hours & " Hours " & Minutes & " Minutes "
& Seconds & " Seconds "
End Function
Thanks to this code, etc., when the report is opened and previewed, the
unbound calculated control (txtElapsedTime) displays a calculation for each
Start Time and End Time, for one example:
"4 Days 9 Hours 41 Minutes 0 Seconds" (W/O quotes!) by subtracting
05/10/1995 4:57:00 PM from 05/15/1995 2:38:00 AM.
This report may contain multiple Start Times and End Times. My question:
How can I sum up all the calculations in the txtElapsedTime control to get a
grand total? Any help will be very much appreciated.
txtStartTime) and an unbound calculated control (txtElapsedTime). The two
bound controls have General Date as their format property. The unbound
calculated control's Control Source contains:
"GetElapsedTime([txtEndTime]-[txtStartTime])" (W/O quotes) from the
GetElapsedTime() function attached to the report, as follows:
Option Explicit
Function GetElapsedTime(interval)
Dim totalhours As Long, totalminutes As Long, totalseconds As Long
Dim days As Long, hours As Long, Minutes As Long, Seconds As Long
days = Int(CSng(interval))
totalhours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
totalseconds = Int(CSng(interval * 86400))
hours = totalhours Mod 24
Minutes = totalminutes Mod 60
Seconds = totalseconds Mod 60
GetElapsedTime = days & " Days " & hours & " Hours " & Minutes & " Minutes "
& Seconds & " Seconds "
End Function
Thanks to this code, etc., when the report is opened and previewed, the
unbound calculated control (txtElapsedTime) displays a calculation for each
Start Time and End Time, for one example:
"4 Days 9 Hours 41 Minutes 0 Seconds" (W/O quotes!) by subtracting
05/10/1995 4:57:00 PM from 05/15/1995 2:38:00 AM.
This report may contain multiple Start Times and End Times. My question:
How can I sum up all the calculations in the txtElapsedTime control to get a
grand total? Any help will be very much appreciated.