PDA

View Full Version : Query on Date n Time Field.



kbsudhir
06-30-2009, 10:31 AM
Hi All,

I am using Access 2003. I have a table with "DateTime" Field.

This field captures the received date n Time for teh incoming mails in by outlook in the belwo format:

"6/29/2009 3:30:12 PM".

Now I want to create a query to pull the deadline from this column. It pull those records which have date of today & time is for after "4Hrs"

Ex. if its 4:00AM in then it pull data for todays date till the time is "<=8:00AM".


Please guide.

Any assitance is appreciated.

Regards

OBP
06-30-2009, 11:37 AM
Split the Date?Time field in to 2 Columns one with date and one with Time formats. Compare the date column to date() in the Criteria Row and the Time to
Between 04:00 and 08:00

kbsudhir
06-30-2009, 11:41 AM
Thanks OBP but how to split them...?????

Also I can't use the static time I have to get the data which is between the current time & four hours after the current time.

kbsudhir
06-30-2009, 12:09 PM
Well, now I am able to split the using format([fieldname],"Long Time") & similarly format([fieldname],"short date") .

But still Iam not able to enter the criteria which can provide the data between current time & 4Hours from the current time.

Please guide

OBP
07-01-2009, 07:32 AM
Between Time() and Time()+#04:00:00#

kbsudhir
07-03-2009, 08:00 AM
I used the same but system is converting "Time()+#04:00:00# to "Time()+"04:00:00 AM",

Please guide.

Regards
Sudhir

OBP
07-04-2009, 03:26 AM
Sudhir, it worked for me in Access 2002.
Does it not work with that conversion as well?

kbsudhir
07-04-2009, 08:07 AM
Nope, its not working in Access 2003.

OBP
07-04-2009, 09:48 AM
Well I am not sure what else to suggest, can you post a copy of the database?

hansup
07-04-2009, 11:17 PM
I used the same but system is converting "Time()+#04:00:00# to "Time()+"04:00:00 AM",
In Access, "time" is a fraction of a day (24 hours). See if you can get it to work this way:

Between Time() and Time() + (4/24)

kbsudhir
07-04-2009, 11:53 PM
Thanks Hansup & OBP.

I will try this out tomorrow when I log into my office.
Also try to update a copy of database.