H
Henro
Below I have the code to calculate hours above 23:59. THe thing is, it seems
to be 'hardcoded' to the field [InstBSItijd] in the table MIS. The table is
OK but how do I make a variable of the field InstBSItijd so that I don't
have to write this code 20 times for the twenty fields on which I need to
use this?
TIA Henro
Function VerzamelUren()
Dim db As DAO.Database, rs As DAO.Recordset
Dim totaaluren As Long, totaalminuten As Long
Dim dagen As Long, uren As Long, minuten As Long
Dim interval As Variant, j As Integer
Dim Kolom
Set db = DBEngine.workspaces(0).databases(0)
Set rs = db.OpenRecordset("Urenregistratie")
interval = #12:00:00 AM#
While Not rs.EOF
interval = interval + rs![InstBSItijd]
rs.MoveNext
Wend
totaaluren = Int(CSng(interval * 24))
totaalminuten = Int(CSng(interval * 1440))
uren = totaaluren Mod 24
minuten = totaalminuten Mod 60
VerzamelUren = totaaluren & " uren en " & minuten & " minuten"
End Function
to be 'hardcoded' to the field [InstBSItijd] in the table MIS. The table is
OK but how do I make a variable of the field InstBSItijd so that I don't
have to write this code 20 times for the twenty fields on which I need to
use this?
TIA Henro
Function VerzamelUren()
Dim db As DAO.Database, rs As DAO.Recordset
Dim totaaluren As Long, totaalminuten As Long
Dim dagen As Long, uren As Long, minuten As Long
Dim interval As Variant, j As Integer
Dim Kolom
Set db = DBEngine.workspaces(0).databases(0)
Set rs = db.OpenRecordset("Urenregistratie")
interval = #12:00:00 AM#
While Not rs.EOF
interval = interval + rs![InstBSItijd]
rs.MoveNext
Wend
totaaluren = Int(CSng(interval * 24))
totaalminuten = Int(CSng(interval * 1440))
uren = totaaluren Mod 24
minuten = totaalminuten Mod 60
VerzamelUren = totaaluren & " uren en " & minuten & " minuten"
End Function