-----Original Message-----
Thanks for your prompt reply Doug, but this doesn't seem
to be working for me. I have the following:
SELECT roomscleaned.RoomNum, roomscleaned.RoomCleanedBy,
roomscleaned.Comment, roomscleaned.RoomDate
FROM roomscleaned
WHERE (((roomscleaned.RoomDate)=DateValue([roomdate])));
However it doesn't seem to work for me. It only returns
the date when there is no time. For example I have 6
records in my table. 3 are just the date, and 3 are the
date and time. When I execute the query, it returns only
those values with just the date. Conversly, when I remove
the records with the just the date, and leave the 3 with
date/time, it doesn't return anything.
Please Help! What on earth could I be doing wrong?!
Thanks,
Confused in Toronto
-----Original Message-----
Sorry, I thought my answer mentioned to use the
DateValue
and/or TimeValue
functions...
SELECT DateValue(MyDateTimeFIeld) FROM MyTable
will give you only the date part of MyDateTimeField. Similarly,
SELECT TimeValue(MyDateTimeFIeld) FROM MyTable
will give you only the time part.
You can use this in the WHERE clause as well:
SELECT Field1, Field2, MyDateTimeField
FROM MyTable
WHERE DateValue(MyDateTimeField) = #04/03/2004#
For the query above, though, it's probably more
efficient
to use
SELECT Field1, Field2, MyDateTimeField
FROM MyTable
WHERE MyDateTimeField BETWEEN #04/03/2004# AND #04/04/2004#
Looking closer at your original post, be aware that the date above is the
3rd of April, 2004, not the 4th of March. Regardless of what your regional
settings have as the short date format, Access will not recognize dd/mm/yyyy
format in queries (unless the day is greater than or equal to 13)
For more information about using international dates in Access, check out
Allen Browne's "International Dates in Access" at
http://members.iinet.net.au/~allenbrowne/ser-36.html or what I have at
http://members.rogers.com/douglas.j.steele/SmartAccess.ht
m
l
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
.
.