Query/Reports Dates

D

Doyle

I am trying to have a report only report on records that are within the last
7 days from the current date and that does not have a date from a [Date Sent]
field.

Example: If the current date is 08/21/08 I would like the report to get all
records that do not have a date in the column and all the records that are
08/14/08 & higher.
 
A

Allen Browne

Try this in the Critiera row of a query, under your date/time field:
Is Null OR >= Date() - 7
 
K

Ken Sheridan

Actually you need to repeat the column name, so in query design view:
= Date()-7 Or [Date Sent] Is Null

In SQL view:

WHERE [Date Sent] >= DATE()-7 OR [Date Sent] IS NULL

This assumes that there are no rows with dates after the current date. I'd
guess that's unlikely but if by any chance this is a possibility:

WHERE ([Date Sent] >= DATE()-7 AND [Date Sent] < DATE()+1) OR [Date Sent] IS
NULL

Note that in the last case the parentheses are crucial to force the AND
operation to evaluate independently of the OR operation.

Ken Sheridan
Stafford, England

Doyle said:
I am trying to have a report only report on records that are within the last
7 days from the current date and that does not have a date from a [Date Sent]
field.

Example: If the current date is 08/21/08 I would like the report to get all
records that do not have a date in the column and all the records that are
08/14/08 & higher.
 

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