Help with Date and Time Query

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
 
J

John Vinson

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]
 
D

Duane Hookom

Try a criteria of:
Between [Enter a Date]+#11:00:00# AND [Enter a Date] + 1.25
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top