访问查询需要“上一整周”

时间:2019-01-04 15:38:07

标签: ms-access

在此查询中-用户必须输入起始和终止日期。有没有设施可以将日期设为“上周”,因为该查询用于每个星期五的员工会议。他们处理上周(周一至周六)的所有案件。我想将其自动化,这就是为什么。

PARAMETERS [Enter From Date:] Text ( 255 ), [Enter To Date:] Text ( 255 );
TRANSFORM Count([Staff Programs].ID) AS CountofProgram
SELECT [Staff Programs].program_name
FROM [Staff Programs]
WHERE ((([Staff Programs].is_noshow)=No) AND (([Staff Programs].[Event_Name]) Not In ('Phone Contact - (Client)','Session Preparation','Research','Clinician Travel','Reporting','Collateral Contact','Correspondence','Data Entry')) AND (([Staff Programs].actual_date) Between [Enter From date:] And [Enter To Date:]))
GROUP BY [Staff Programs].program_name
PIVOT [Staff Programs].staff_name;

1 个答案:

答案 0 :(得分:0)

尝试一下

TRANSFORM Count([Staff Programs].ID) AS CountofProgram
SELECT [Staff Programs].program_name
FROM [Staff Programs]
WHERE ((([Staff Programs].is_noshow)=No) AND (([Staff Programs].[Event_Name]) Not In ('Phone Contact - (Client)','Session Preparation','Research','Clinician Travel','Reporting','Collateral Contact','Correspondence','Data Entry')) AND (([Staff Programs].actual_date) Between Date() - ( 6 + Weekday(Date(), 2)) And Date() - Weekday(Date(), 1)))
GROUP BY [Staff Programs].program_name
PIVOT [Staff Programs].staff_name;