在查询窗口中,如果用设置了初始值的var变量Date1,Date2绑定startdate,enddate日期输入框,代码如下
With e.Form.Controls("StartDate")
If .Value IsNot Nothing
Then
If Filter >"" Then
Filter = Filter & " And "
End
If
Filter = Filter & "日期 >= #" & Vars("Date1") & "#"
End
If
End
With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing
Then
If Filter >"" Then
Filter = Filter & " And "
End
If
Filter = Filter & "日期 <= #" & Vars("Date2") & "#"
End
If
End
With
[此贴子已经被作者于2012-2-13 12:07:23编辑过]