Mayank Jani

Mayank Jani

  • NA
  • 477
  • 76.6k

Fetch record by time ASC

Mar 24 2018 8:34 AM
Hello Members,
Greetings of the day...
 
I wrote a query for fetching records of employees logged in with time ascending order but it is not showing in proper order.
First let me tell you the parameteres I am using.
table field is Text in MS Access. the time is recorded in the field as '09:15 AM'. the date and the time are in different fields.
 
I want to get the data as Order By EmpTime with ASC so, it should be...
 
1. ABC 11:30 AM
2. DEF 01:00 PM
3. GHI  02:20 PM
 
but the result shows...
 
1. DEF 01:00 PM
2. GHI  02:20 PM
3. ABC 11:30 PM
 
it only orders for the digits and not by AM to PM. my query is...
 
"Select EmpName, EmpDesig, EmpTime from LogReg Where TheDate=' "+DateTime.Today.To.ShortDateString()+" ' Order By EmpTime ASC
 
Request your help where I am mistaking. using different combination of 'Order By' and ASC multiple filelds not working. either output is incorrect or error.
 
Thank You.
 
Mayank Jani

Answers (4)