Hi Experts, my sql query below returns 0 value, though I have entries in my data base. Please help me check my codes below;
Private Sub cmdSearch_Click()
Dim sTrID As String
sTrID = txtSearch.Text
Dim Total As Integer
Set rs = New ADODB.Recordset
rs.Open "Select Count(DateIn) as Total from Time_In where Employees_IdNo = '" & sTrID & "'", cn, adOpenKeyset, adLockPessimistic
If Not rs.EOF Then
lblTotal_Days.Caption = Total
Ado.RecordSource = "Select Count(DateIn) as Total from Time_In where Employees_IdNo = '" & sTrID & "'"
Ado.Refresh
rs.Close
Set rs = Nothing
Else
MsgBox "No records found! ", vbExclamation, "DailyRecords"
End If
End Sub