Good Day all,
I have a field "Time Entered by Officer" which is of data type Date/Time. I realize that my code shown below does not sort the field for all the values. I know that somewhere I have to use the TimeValue function; this I tried but it does not work.
In my code below the problem lies with the ORDER BY ([Time Entered by Officer]) section. The code as given works well except that some of the values are not sorted. When I Try TimeValue([Time Entered by Officer]), I get the error message "data type mismatched in criteria expression"
Can any one assist?
Code:
Do
strfilter = " [OfficerName] ='" & OfficerName & "' And DateValue([Auto Date]) = # " & dynamicDate & "#" & " ORDER BY ([Time Entered by Officer])"
Set rs = CurrentDb.OpenRecordset _
("SELECT tblSignIn.*, [Time Entered by Officer] FROM tblSignIn LEFT JOIN tblSigninDetails ON tblSignIn.[tblSignInID] = tblSigninDetails.TblsignInID WHERE " & strfilter)