Reference Time in Query

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

I have been trying to query records that fall between
08:00 AM and 05:00 PM. The Date field this is pulling
from is stored as a Date/Time field - mm/dd/yyyy
hh:mm:ss. I cannot change the format in the Table, and
changing it in the query doesn't seem to help.

I've tried several ways, here's one of them...
StartCode: IIf([StartTime] Between #8:00:00 AM# And
#5:00:00 PM#,1,0)

Can you help?
Thanks,
Mary
 
I think you need to use datepart to pull out the time and then use that in
your criteria.
 
StartCode: IIf(TimeValue([StartTime]) Between #8:00:00 AM# And #5:00:00
PM#,1,0)
 
YES! That worked, thanks so much!
-----Original Message-----
StartCode: IIf(TimeValue([StartTime]) Between #8:00:00 AM# And #5:00:00
PM#,1,0)


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have been trying to query records that fall between
08:00 AM and 05:00 PM. The Date field this is pulling
from is stored as a Date/Time field - mm/dd/yyyy
hh:mm:ss. I cannot change the format in the Table, and
changing it in the query doesn't seem to help.

I've tried several ways, here's one of them...
StartCode: IIf([StartTime] Between #8:00:00 AM# And
#5:00:00 PM#,1,0)

Can you help?
Thanks,
Mary


.
 
Back
Top