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.
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.