Full Version: Help required with time criteria in a query
UtterAccess Forums > Microsoft® Access > Access Date + Time
giffordr82
Gents
sorry for the stupid question but I've gone completely blank.
I have a table with a time field and a format as Medium Time. (ie 06:00 AM).
I want to be able to create a query that has criteria in that will show all the AM times and then one that will show all PM times.
I thought I could just type LIKE *PM but this doesn't bring anything back in the query.
Can someone give me a kick in the right direction please.
Sorry for the dumb question.
Cheers
Ron
cheekybuddha
Hi Ron,
imes are stored as dates in Access (if you have specified Date/Time as the datatype of your field).
Try as your criteria:
am:
Betewen #00.00.00# And #11.59.59#
pm
Between #12.00.00# And #23.59.59#
If this does not produce the results you want you may have to format your Time field explicitly in the query.
eg:
Select YourTimeField From YourTable Where Format([YourTimeField], "hh:nn:ss") Between #00.00.00# And #11.59.59#
hth,
d
giffordr82
Your a star thank you very much.
Odid try the between criteria earlier but didn't include the seconds side of things.
Thats probably why it didn't work...
Thanks again
Regards
Ron
cheekybuddha
You're welcome.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.