Records under/over 3 days old

gbnz

Registered User.
Local time
Today, 16:41
Joined
Mar 12, 2010
Messages
63
I am working on determining records that are under or over 3 days old. I just can't seem to get the syntax for Access correct.

Here is my SQL query for greater than 3 days:
Code:
SELECT * 
FROM
    AFETaskView
WHERE
    Created < DATEADD(day, -3, getdate())
I just can't seem to work it out for Access which doesn't recognize the "getdate" function.

Thanks
gbnz
 
Thanks for the link. Are you sure this won't work?

Code:
SELECT *
FROM dbo_AFETaskView
WHERE (((dbo_AFETaskView.StatName)="In Progress") AND ((dbo_AFETaskView.Created)<=DateAdd("d",-3,Date())));
Because I am receiving the desired result.
 
You will get the desired result when the format of the ![Created] field is a date.

If it is not then you are lucky in the way it is working and you could expect to fail across month boundaries.
 
You wrote this:

are under or over 3 days old

Which is logically equivalent to saying "are not 3 days old". The code you have written satisfies this statement:"less than or equal to 3 days old".
 
You wrote this:



Which is logically equivalent to saying "are not 3 days old". The code you have written satisfies this statement:"less than or equal to 3 days old".

Sorry my mistake. I meant 2 different queries and should have stated that.

Thanks for the help.
 

Users who are viewing this thread

Back
Top Bottom