I need help with a query. I suspect I need to use the DateDiff function, but don't know much about using it.
I have two tables. The first field of both tables, Agreement, should be present in both tables. On each table there is a different date associated with the Agreement, different on each table. I want to pull the Agreement, some other fields and both dates in my query, but I only want the records where the two dates have 31 or more days between them.
Here's what I wrote, but I get an error message:
SELECT qryReratesWithOptionsAfter2000.*, tblNewBusiness.CycleDate
FROM tblNewBusiness, qryReratesWithOptionsAfter2000
WHERE tblNewBusiness.Agreement = qryReratesWithOptionsAfter2000.Agreement AND DateDiff("31",[tblNewBusiness].[CycleDate], [qryReratesWithOptionsAfter2000].[CycleDate]);
Is my syntax wrong? Any ideas on how to do this differently, perhaps?
I have two tables. The first field of both tables, Agreement, should be present in both tables. On each table there is a different date associated with the Agreement, different on each table. I want to pull the Agreement, some other fields and both dates in my query, but I only want the records where the two dates have 31 or more days between them.
Here's what I wrote, but I get an error message:
SELECT qryReratesWithOptionsAfter2000.*, tblNewBusiness.CycleDate
FROM tblNewBusiness, qryReratesWithOptionsAfter2000
WHERE tblNewBusiness.Agreement = qryReratesWithOptionsAfter2000.Agreement AND DateDiff("31",[tblNewBusiness].[CycleDate], [qryReratesWithOptionsAfter2000].[CycleDate]);
Is my syntax wrong? Any ideas on how to do this differently, perhaps?