【发布时间】:2017-10-18 21:45:41
【问题描述】:
我正在尝试打开带有条件的表单。
我得到错误的标准。
strCriteria = "WorkID = 3 And
OptOut= -1 And
AppointmentDate = (Last(AppointmentDate))>DateSerial(Year(Date()),Month(Date())-3,1) And
(Last(AppointmentDate))<DateSerial(Year(Date()),Month(Date())-2,0)"
我这样放置是为了更容易阅读。
我的错误号是 3096。
谢谢。
====更新我放弃======= 到目前为止我的代码。
strSQL = "SELECT tblAppointment.WorkID," & _
"tblCustomer.OptOut," & _
"Last(tblAppointment.AppointmentDate) AS LastAppointmentDate," & _
"tblAppointment.CustomerID," & _
"tblCustomer.Surname," & _
"tblCustomer.Name," & _
"tblCustomer.FatherName," & _
"Last(tblAppointment.AppointmentMemo) AS LastAppointmentMemo" & _
"FROM tblCustomer INNER JOIN tblAppointment ON tblCustomer.CustomerID = tblAppointment.CustomerID " & _
"GROUP BY tblAppointment.WorkID," & _
"tblCustomer.OptOut," & _
"tblAppointment.CustomerID," & _
"tblCustomer.Surname," & _
"tblCustomer.Name," & _
"tblCustomer.FatherName " & _
"HAVING (((tblAppointment.WorkID) = 3) And ((tblCustomer.OptOut) = -1) And " & _
"(LastAppointmentDate > DateSerial(Year(Date()), Month(Date()) - 3, 1) And " & _
"LastAppointmentDate < DateSerial(Year(Date()), Month(Date()) - 2, 0)))" & _
"ORDER BY LastAppointmentDate, " & _
"tblCustomer.Surname," & _
"tblCustomer.Name," & _
"tblCustomer.FatherName;"
【问题讨论】:
-
为什么不使用查询生成器?
标签: string forms ms-access where criteria