need help with selecting based on time

  • Thread starter Thread starter topdawg25
  • Start date Start date
T

topdawg25

Guest
HELP!!!!!!

I'm trying to select records from a table based on appt time. (format of time is 8:01:00 AM,) What i need to extract is records as folows (8:01:00 AM, 8:31:00 AM ... 16:31:00 PM) but my SQL statement is only selecting 8:31:00 AM. below is a sample of the SQL Query, Can someone tell me what I'm doing wrong.


SELECT [Dec10/04].Time, [Dec10/04].[CUSTOMER NAME], [Dec10/04].YR, [Dec10/04].MODEL, [Dec10/04].VEHID, [Dec10/04].ESTDUR
FROM [Dec10/04]
WHERE ((([Dec10/04].Time)=TimeSerial(7,31,0) Or ([Dec10/04].Time)=TimeSerial(8,1,0) Or ([Dec10/04].Time)=TimeSerial(8,31,0) Or ([Dec10/04].Time)=TimeSerial(9,1,0) Or ([Dec10/04].Time)=TimeSerial(9,31,0)))
ORDER BY [Dec10/04].Time;


Thanks
Jamie
 
Jamie,

Try this:

SELECT Format([time],"Short Time") AS Timetxt, [Dec10/04].[customer name], [Dec10/04].yr, [Dec10/04].model, [Dec10/04].vehid, [Dec10/04].estdur
FROM [Dec10/04]
ORDER BY Format([time],"Short Time");

Stu
 
Works great but !!!!

Stu

That selected all records, but what I need now is a filter (of sorts) I need to select WHERE time = 8:01 or 9:01 ... 14:31 can you give me an example please.

Thanks Jamie
 
Jamie,

Try this...

SELECT Format([time],"Long Time") AS Timetxt, [Dec10/04].[customer name], [Dec10/04].yr, [Dec10/04].model, [Dec10/04].vehid, [Dec10/04].estdur
FROM [Dec10/04]
WHERE (((Format([time],"Long Time"))=#12/30/1899 16:31:0#))
ORDER BY Format([time],"Long Time");

Do not worry about the "12/30/1899" part... just modify the time "16:31:0" part.

Stu
 
Thank you

Stu,

It worked Great... Thanks

All I need to do now is use that type of SQL statement in Visual Basic. I'll figure it out from here......I think

Thanks again

Jamie
 

Users who are viewing this thread

Back
Top Bottom