Question Locked

count records between a specific time range

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a table with an "Admit_Time" column. I need to count the records for 3 specific time ranges a) >= 00h and <= 0700h, b) > 0700h and <= 1700h, c) >1700h and <= 2400h.

I tried to created a query with using the criteria >#00:00:00 AM# And <=#07:00:00 AM# in the 'Admit_Time' field but Access won't accept the 00:00:00 AM. It kept replacing it with 12:00:00 AM.

If there is a better way to accomplish what I am trying to do, I would appreciate your help.

Thanks.

2 replies

by tony hopkinson

Datepart("h",Admit_Time) will return 0 to 23

Daresay it's a locale problem in terms of the time format, always iffy those.

Your ranges are a minute out as well

< 7
>= 7 and < 17
> 17

2400 doesn't exist, that's tomorrow

This discussion is closed to new replies.