Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 5th, 2006, 01:40 PM
hnn0404 hnn0404 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Posts: 1 hnn0404 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 6 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Advance Hour Sum Function Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT