我想将以下内容从设定日期范围转换为整月范围:
Set rs = CurrentDb.OpenRecordset("SELECT Count(Advisors) AS TotalNumber FROM tbl_ComplaintsCoded WHERE Advisors = '" & Forms!frm_Central_Reporting_ops!Label44.Caption & "' AND [Mail Date] between #01/04/2016# AND #30/04/2016#")
我试过了:
Set rs = CurrentDb.OpenRecordset("SELECT Count(Advisors) AS TotalNumber FROM tbl_ComplaintsCoded WHERE Advisors = '" & Forms!frm_Central_Reporting_ops!Label44.Caption & "' AND month[Mail Date] ='April'")
也尝试过:
Set rs = CurrentDb.OpenRecordset("SELECT Count(Advisors) AS TotalNumber FROM tbl_ComplaintsCoded WHERE Advisors = '" & Forms!frm_Central_Reporting_ops!Label44.Caption & "' AND month[Mail Date] ='4'")
提前感谢您的帮助
答案 0 :(得分:1)
如前面的评论所述,您可能也想参考一年,否则所有“四月”项目都将包括在内,无论年份如何。
Set rs = CurrentDb.OpenRecordset("SELECT Count(Advisors) AS TotalNumber FROM tbl_ComplaintsCoded WHERE Advisors = '" & Forms!frm_Central_Reporting_ops!Label44.Caption & "' AND month([Mail Date]) =4")