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 = ""
            lbliam.Caption = .Fields("IN_AM").Value
        End If
         If IsNull(.Fields("OUT_AM")) = True Then
            lbloam.Caption = ""
            lbloam.Caption = .Fields("OUT_AM").Value
        End If
         If IsNull(.Fields("IN_PM")) = True Then
            lblipm.Caption = ""
            lblipm.Caption = .Fields("IN_PM").Value
        End If
        If IsNull(.Fields("OUT_PM")) = True Then
            lblopm.Caption = ""
            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)

End With

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.

This article has been dead for over six months. Start a new discussion instead.