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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query bringing up last 14 days

Status
Not open for further replies.
May 28, 2003
13
US
I know you probably get this one all the time, but I need to know what I can put in the criteria of a query that will bring up dates from 14 days ago to the current.
 
Use the following as a model for your query:
Select *
FROM YourTableName as A
WHERE A.[DateField] >= DateAdd("d", -14, Date()));

Just update the the table name and Date Field Name.

Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Where does that go into this expression?

SELECT Hours.FristLast, Hours.Hours_Spent, Hours.Date, Hours.Project, Hours.Type
FROM Hours
WHERE (((Hours.Type)="over-time"))
 
I think this should do it:

SELECT Hours.FristLast, Hours.Hours_Spent, Hours.Date, Hours.Project, Hours.Type
FROM Hours
WHERE (Hours.Date)>= DateAdd("d", -14, Date());

I assumed the field that you wanted to perform the criteria select on was Hours.Date.



Bob Scriver

Nobody believes the official spokesman... but everybody trusts an unidentified source.
Author, Bagdad Bob???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top