How do I add all time values in a database table to get its total, get the total tardiness then sum up to know how many days an employee is absent or present in a monthly basis?

Come up with an idea and we'll help you fine tune it.

Here's what i have at the moment.

Private Sub Compute()

'lblhuam.Caption = DateTime.DateDiff("H", lbliam.Caption, lbloam.Caption)
'lblhupm.Caption = DateTime.DateDiff("H", lblipm.Caption, lblopm.Caption)

Dim Totam As String
Dim Totpm As String
Dim Totall As String

Con "Database.mdb"
With RecSet


    .Open "Select * from TimeLog where ID =" & Text1.Text, DBLink, adOpenKeyset, adLockPessimistic

    While .EOF = False
        
            lbldate.Caption = .Fields("DATE_LOG").Value
        
        If IsNull(.Fields("IN_AM")) = True Then
            lbliam.Caption = ""
        Else
            lbliam.Caption = .Fields("IN_AM").Value
        End If
        
         If IsNull(.Fields("OUT_AM")) = True Then
            lbloam.Caption = ""
        Else
            lbloam.Caption = .Fields("OUT_AM").Value
        End If
        
         If IsNull(.Fields("IN_PM")) = True Then
            lblipm.Caption = ""
        Else
            lblipm.Caption = .Fields("IN_PM").Value
        End If
        
        If IsNull(.Fields("OUT_PM")) = True Then
            lblopm.Caption = ""
        Else
            lblopm.Caption = .Fields("OUT_PM").Value
        End If
        
        Totall = Totpm + Totam
        
        Totam = Hour((.Fields("OUT_AM")) - (.Fields("IN_AM")))
        Totpm = Hour((.Fields("OUT_PM")) - (.Fields("IN_PM")))
        lblhuam.Caption = Totam
        lblhupm.Caption = Totpm
        lblmuam.Caption = Val(Totam) + Val(Totpm)
        
        .MoveNext
    
    Wend
    
    .Close

End With
DBLink.Close


End Sub

But it only computes the 2 fields. I would like to compute all the total hours of that employee for the whole 1 month.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.