wh00t
Registered User.
- Local time
- Today, 23:14
- Joined
- May 18, 2001
- Messages
- 264
I have the following code to calculate times
this is used when users enter information about people working on a shift to give a total of man hours worked.
the code works fine, but.
the users occasionally return to an entered time and ammend it, unfortunatly I can not figure out a way of automatically reducing the time based on users ammendments.
does anyone have any ideas?
Code:
Public Function GetTimeCardTotal()
Dim Db As Database, Rs As Recordset
Dim totalhours As Long, totalminutes As Long
Dim days As Long, hours As Long, minutes As Long
Dim interval As Variant, j As Integer
Set Db = DBEngine.Workspaces(0).Databases(0)
Set Rs = Db.OpenRecordset("Hours")
interval = #12:00:00 AM#
While Not Rs.EOF
interval = interval + Rs("hours") - Int(Rs("hours"))
Rs.MoveNext
Wend
totalhours = Int(CSng(interval * 24))
totalminutes = Int(CSng(interval * 1440))
minutes = totalminutes Mod 60
GetTimeCardTotal = totalhours & " hours and " & minutes & " minutes"
End Function
this is used when users enter information about people working on a shift to give a total of man hours worked.
the code works fine, but.
the users occasionally return to an entered time and ammend it, unfortunatly I can not figure out a way of automatically reducing the time based on users ammendments.
does anyone have any ideas?