Help with Date and Time Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I hope someone can help me with this;

I am using Access 2003 and I have a date and time field. I would like to
have a query that I enter the date into and it retrieves the records for that
date from 11:00 am until 06:00 am the following day.

I tried [Enter Date:] or [Enter Date:]+1 under the date criteria, and using
AND >= 11:00:00 OR <= 06:00:00 undr the time criteria, but I get the error
that the expression is too complicated or something like that....

Any help woul dbe appreciated.

Thanks
 
I hope someone can help me with this;

I am using Access 2003 and I have a date and time field. I would like to
have a query that I enter the date into and it retrieves the records for that
date from 11:00 am until 06:00 am the following day.

I tried [Enter Date:] or [Enter Date:]+1 under the date criteria, and using
AND >= 11:00:00 OR <= 06:00:00 undr the time criteria, but I get the error
that the expression is too complicated or something like that....

Any help woul dbe appreciated.

Thanks

A Date/Time value is actually stored as a Number: a count of days and
fractions of a day since midnight, December 30, 1899.

You might want to use
= DateAdd("h", 11, DateValue([Enter date:])) AND <= DateAdd("h", 30, DateValue([Enter date:]))

DateValue will trim off the fractional portion (time) of the date
entered (just in case the user types "1/23/06 10:00am" for some
reason). DateAdd will give you the two times you specified - on that
date and the next date (since you're adding over 24 hours).

John W. Vinson[MVP]
 
Back
Top