[Ender Date]+1 Query Problem

D

Don

I am having an issue with a microsoft access query.

I am trying to attempt the following.

I have a table with a field that shows the Date and time in the same
field. Format is as follows

08/31/2006 5:25 PM

I am trying to produce a query that will prompt me for a date.

The query needs to produce the following results.

Input Value - Date = 3/31/2006

Results need to be all data between 3/31/2006 6:00am to 4/1/2006
6:00am

basically my query is this
[form.datetxt] & 6:00:00 AM and <[form.datetxt]+2 & 6:00:00 AM

Howerver, this command is too complex for access.
I hope someone can help me with this.

Don
 
J

John Vinson

Input Value - Date = 3/31/2006

Results need to be all data between 3/31/2006 6:00am to 4/1/2006
6:00am

basically my query is this
[form.datetxt] & 6:00:00 AM and <[form.datetxt]+2 & 6:00:00 AM

A Date isn't a string. It's actually stored as a Double Float number,
a count of days and fractions of a day.

Try a criterion of
= DateAdd("h", 6, [Enter Date:]) AND < DateAdd("h", 30, [Enter Date:])

A pure date with no time component has a fractional part of 0, and is
treated as midnight at the beginning of that day; you want the period
from six hours later than that, to a day and six hours = 30 hours
later.

John W. Vinson[MVP]
 
D

Don

John,

Thank you very much, Your query string is exactally what I was
looking for. I appreciate your speedy response.

Don Hayes
 

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