Hi experts, I have a Daily Records form of an employee.
my fields are;
datagridview (fields are Employees_IdNo, DateIn, TimeIn and TimeOut)
The scenario is this, first search for an employee using Employee number, set the datefrom and dateto to two datepickers and click Seach button. After clicking, on the datagridview the dates will display from the range set.
Second, when the range date already displayed on datagridview, the label -totaldayswork- automatically display its total days as well as the total number of hours work for regular and overtime. The time of overtime is after regular office hours eg. 9:00 am to 5:00pm- after 5:00pm is overtime.
I have below codes but I see no results;
Private Sub cmdSearch_Click() Dim sTrID As String sTrID = txtSearch.Text Set rs = New ADODB.Recordset rs.Open "Select Employees_IdNo,DateIn, TimeIn, TimeOut from Time_In where Employees_IdNo = '" & sTrID & "'", cn, adOpenKeyset, adLockPessimistic If Not rs.EOF Then Ado.RecordSource = "Select Count(DateIn) as daycount from Time_In where Employees_IdNo = '" & sTrID & "'" Ado.Refresh lblTotal_Days.Caption = daycount ''no code yet for the totalhours and ovetime rs.Close Set rs = Nothing Else MsgBox "No records found! ", vbExclamation, "DailyRecords" End If End Sub