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

Calculating Dates 1

Status
Not open for further replies.

tdonahue

Technical User
Feb 4, 2001
50
0
0
US
I need to create a daily report that queries when something was entered into the database. When a record gets entered into the database it is datestamped in a column named TodaysDate. What would be the command I would use to calculate the date automatically. I need to create 7 queries. One less than 7 days, 7 to 14 days, >14 days to current month, added in Dec, added in Nov, added in Oct, added before Oct 1.
I tried

SELECT TblOPTICS.TodaysDate, TblOPTICS.Qty, TblOPTICS.Cost, [Qty]*[Cost] AS [Total Cost]
FROM TblOPTICS
WHERE (((TblOPTICS.TodaysDate)=[Date]-7) AND ((TblOPTICS.DateShipped) Is Null))
ORDER BY TblOPTICS.TodaysDate;
and


SELECT TblOPTICS.TodaysDate, TblOPTICS.Qty, TblOPTICS.Cost, [Qty]*[Cost] AS [Total Cost]
FROM TblOPTICS
WHERE (((TblOPTICS.TodaysDate)=[TodaysDate]-7) AND ((TblOPTICS.DateShipped) Is Null))
ORDER BY TblOPTICS.TodaysDate;


and these did not work.




 
Try
WHERE(((TblOPTICS.TodaysDate)Between Date() And Date()-7)

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top