sql查询的问题,急于解决,请指教!
我有两个窗体,第一个窗体里是一些查询的功能,其结果显示在第二个窗体里的datagrid里。现在我在第二个窗体里加一个command和两个label控件,希望在按下command控件后,label里出现我需要的内容,代码如下:
Private Sub Command1_Click()
dim strsql,strsql1,strsql2 as string
strsql = "select * from box where 1=1 " & Trim(ss)
strsql1 = strsql & "and 返回日期=''"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = strsql4
Adodc1.Refresh
Label1.Caption = "共计:" + Str(Adodc1.Recordset.RecordCount) + "份"
strsql1 = strsql & " and 返回日期=''" & "and DateDiff('d', 交接日期, today) " & "<= 15"
Adodc1.RecordSource = strsql1
Adodc1.Refresh
Label1.Caption = "周期《2周:" + Str(Adodc1.Recordset.RecordCount) + "份"
End Sub
其中Trim(ss)是我在第一个通过property let方法引用过来的第一个窗体的查询条件,已经证明是完全正确的。但当我执行上面代码时,提示对话框显示“语法错误(操作符丢失)在查询表达式‘1=1 and 返回日期='''中。其中“返回日期”和“交接日期”都是我与adodc1链接的access表中的两个字段。是否在这个程序段里要对这两个字段进行重新定义?这段程序还有其他错误吗?
谢谢指教!!