PDA

View Full Version : Solved: Query On DateTime Field



kbsudhir
04-09-2008, 10:29 AM
Hi All,

I have a table in which I maintain all the details of the details of the incoming mails.

The date & time of the mail is captured under field name - ReceivedDateTime in below format:-

4/9/2008 9:32:42 AM

I want to pull the particulars of only those mails which I received today.

I used where condition on ReceivedDatetime field & gave the date #4/9/2008# but still it not pulling anything from the table.

I also tried to giving Date() as criteria but of no use.

Can anybody let me know how to give the criteria so that it pulls the data as per the given date. Or to Give citeria as Date() so that query always pulls the data for the current day.

Thanks
Sudhir

Norie
04-09-2008, 10:42 AM
sudhir

It's not the criteria that's the problem it's the fact it includes the time.

There probably a couple of ways to sort this.

One of the easiest would perhaps be using the Int function to return only the date.

OnlyTheDate:Int([YourDateField])

Then set the criteria against this expression.

Trevor
04-09-2008, 12:07 PM
I agree with Norie
the other thing you could do is sperate the Date and Time into 2 seperate fields then set your criteria on the date you enter

kbsudhir
04-09-2008, 03:21 PM
Thanks Guys Its working.

:bow: :bow: