Date Query Issue

veder

Registered User.
Local time
Today, 17:36
Joined
Jun 19, 2006
Messages
13
I have a query that includes a [Last_Updated] field. I want to pull records into a report (this query is the report's data source) where the last updated date is less than 7 days from the current date. What I have now is... DateAdd("d",-7,Date()) in the Criteria row of the [Last_Updated] field, but this isn't working - its excluding all records. I also tried >("d",-7,Date()). Not sure what would work here?

Any assistance would be GREATLY appreciated.

thanks!!!!
 
The criteria should be:

DateDiff("d", [LastUpdated], Date) < 7
 
thanks but now something else is happening...

Thanks for the help, small issue though...

I entered that into the criteria cell and now I'm getting a parameter window popping. When I tried to enter anything, an error message was returned saying that 'the expression is typed incorrectly or the calculation is too complex...'. I went back into the query through the design view and now that same line I typed into the criteria cell has become its own new field w/ the >7 in the new field's criteria cell???

Any thoughts?
 
Sorry, I missed a little
In the criteria it should be:
Code:
DateDiff("d", [LastUpdated], Date()) < 7

I forgot to put the () in the Date function. In a query it is required and in VBA it isn't.
 
in your [Last_Updated] field this might be enough, too:
>Date()-7
 
thanks!!!

Actually, both suggestions help!!!

thanks so much!!
veder
 

Users who are viewing this thread

Back
Top Bottom