Reference Time in Query

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
 
R

Rick B

I think you need to use datepart to pull out the time and then use that in
your criteria.
 
D

Douglas J. Steele

StartCode: IIf(TimeValue([StartTime]) Between #8:00:00 AM# And #5:00:00
PM#,1,0)
 
M

Mary

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


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top