|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Advance Hour Sum Function Problem
though I have the "hoursandminutes" module working which calculates time elaspse in the form of [hh]:ss
The results can be hhh:ss or hh:ss or h:ss The problem is this... these numbers cannot be added, please advise..... Please help with the coding.... here's what I got from other users... Function Addhr(First, Second) 'Divides the two time format numbers into parts:'Hours, Minutes And Seconds. Firsth = Left(First, 3) Firstm = Mid(First, 4, 2) Firsts = Right(First, 2) Secondh = Left(Second, 2) Secondm = Mid(Second, 4, 2) seconds = Right(Second, 2) '----------------------------' Adds the numbers and makes sure that it will' always be with two characters uth = Val(Firsth) + Val(Secondh) If Len(uth) = 1 Then uth = "0" & uth utm = Val(Firstm) + Val(Secondm) If Len(utm) = 1 Then utm = "0" & utm uts = Val(Firsts) + Val(seconds) If Len(uts) = 1 Then uts = "0" & uts '----------------------------' If the Seconds are higher than 60 then add' one to the Minutes and subtract from the seconds' 60 If uts > 59 Then Do uts = Val(uts) - 60 If Len(uts) = 1 Then uts = "0" & uts utm = Val(utm) + 1 If Len(utm) = 1 Then utm = "0" & utm Loop Until uts <= 59 End If '----------------------------' If the Minutes are higher than 60 then add' one to the Hours and subtract from the Minutes' 60 If utm > 59 Then Do utm = Val(utm) - 60 If Len(utm) = 1 Then utm = "0" & utm uth = Val(uth) + 1 If Len(uth) = 1 Then uth = "0" & uth Loop Until utm <= 59 End If '----------------------------' Returns the Total Time newTotal = uth & ":" & utm & ":" & uts MakeTotalTime = newTotal End Function |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Advance Hour Sum Function Problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|