Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date range on query

Status
Not open for further replies.

florida41

Technical User
May 13, 2004
95
US
How can I show records in my Access 2000 database where a job is submitted and it stays in the query for only 7 days.
Basically it will expire and not show in my query 7 Days after the EntryDate.

For example my field name called entryDate would be the date of entry for the job:

Code:
ID     Name      EntryDate    
1      JobOne    8/01/2004
2      JobTwo    8/20/2004
3      JobThree  8/24/2004
4      JobFour   8/14/2004
5      JobFive   8/19/2004

Only jobs that were 7 days or less old would show up in my Query results.
The below will output for todays date (8/24/2004):
Code:
2      JobTwo    8/20/2004       -->Expires on 8/27/2004
3      JobThree  8/24/2004       -->Expires on 8/31/2004
5      JobFive   8/19/2004       -->Expires on 8/26/2004

These jobs will not show in the query because they are older than 7 days after the entryDate
Code:
1      JobOne    8/01/2004       -->Expired on 8/08/2004
4      JobFour   8/14/2004       -->Expired on 8/21/2004



My attempt at this query is not working:
Code:
select * from myTable
where entryDate > Date()+7


Please advise.
 
Shouldnt that be:

select * from myTable
where entryDate <= Date()+7

-VJ
 
Something like this ?
select * from myTable
where entryDate >= Date()-7

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top