|
我的做法和todaynew 版主比较接近
dim strSql1 as string
Dim TjCj as string,TjZt as string,TjRqS as tring,TjRqE as string
if Me.厂家<>"" and isnull(Me.厂家)=false then Tjcj=" AND 厂家='" & trim(Me.厂家) & "'"
if Me.状态<>"" and isnull(Me.状态)=false then Tjzt=" AND Flag="& Me.状态
if Me.开始日期<>"" and isnull(Me.开始日期)=false then TjRqS=" AND 日期>=#"& Me.开始日期 &"#"
if Me.开始日期<>"" and isnull(Me.结束日期)=false then TjRqS=" AND 日期<=#"& Me.结束日期 &"#"
strSql1="SELECT * FROM tbl_表 WHERE 1=1 "& TjCj & TjZt & TjRqS & TjRqE
至于两个日期输入框就不要去判断了,直接将它的格式设为日期格式就可以了,这样只能输入日期而不能输入其它格式的数据了 |
|