chiodde
02-07-2002, 06:59 AM
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)
David R
02-07-2002, 07:14 AM
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).]
chiodde
02-08-2002, 03:19 AM
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
chiodde
02-08-2002, 05:01 AM
RE: dateAdd() function.
David,
Works a treat! Thanks again.
Dave