Querying by date

  • Thread starter Thread starter chiodde
  • Start date Start date
C

chiodde

Guest
I am attempting to create a sql query that generates all records whose 'date due' field is 3 days after today (i.e will show all projects (records) that are due in three days time). I have ben experimenting with DATEDIFF() function, but to no avail.

I am reasonably inexperienced with these computer things and would appreciate any help offered.

Many thanks
dave (new and desperate member)
 
The function you've been hunting for is DateAdd().
Your SQL WHERE clause should be:
WHERE (([Source].[DateDueField]) Between Now() And DateAdd("d",3,Now()))
(for all projects due in the next three days, including today)

Alternatively, you CAN use DateDiff() if you want. You'll have to add a calculated field though: DateDifference: DateDiff("d",[DateReceived],Now())
And then in the Criteria: <3

And then remember not to show that field and add your real date field back in. Which is why I go with DateAdd().

HTH,
David R




[This message has been edited by David R (edited 02-07-2002).]
 
Dave,

Thank you very much for the time and effort spent on replying to my question. I have not yet tried your suggestion, but will let u know when it is working.

Thanks again
dave
 
RE: dateAdd() function.

David,

Works a treat! Thanks again.

Dave
 

Users who are viewing this thread

Back
Top Bottom