Querying using date range in Access 2003

  • Thread starter Thread starter susan
  • Start date Start date
S

susan

i'm trying to set my query to pull records input in the
last 7 days. how do i input my criteria? the field
is "date entered" and i want records from the last 7 days
to appear in the query result. i don't want to use any
exact date... i always want it to be 7 days from whatever
today is. Any ideas?
 
susan said:
i'm trying to set my query to pull records input in the
last 7 days. how do i input my criteria? the field
is "date entered" and i want records from the last 7 days
to appear in the query result. i don't want to use any
exact date... i always want it to be 7 days from whatever
today is. Any ideas?


SELECT SomeFields FROM SomeTable
WHERE [date entered] > Date()-7
 
Rick Brandt's solution is excellent as long as you don't have dates in [Date
Entered] that are in the future. I would guess that would be the case with a
field named [Date Entered]. A more generalized solution would be

SELECT SomeFields
FROM SomeTable
WHERE SomeDate >= Date() - 7
AND SomeDate < Date() + 1

This works to catch all records where the date is between Midnight 7 days ago
and 11:59:59 of the current date.


Rick said:
susan said:
i'm trying to set my query to pull records input in the
last 7 days. how do i input my criteria? the field
is "date entered" and i want records from the last 7 days
to appear in the query result. i don't want to use any
exact date... i always want it to be 7 days from whatever
today is. Any ideas?

SELECT SomeFields FROM SomeTable
WHERE [date entered] > Date()-7
 
Back
Top