Dim sf As WinForm.TextBox = e.Form.Controls("按地区查询")
Dim dwmc As WinForm.TextBox = e.Form.Controls("按单位查询")
Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("起始日期")
Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim Filter As String = "1=1"
If sf.Value IsNot Nothing Then
Filter &= " and 省份 Like '%" & sf.text & "%'"
End If
If dwmc.Value IsNot Nothing Then
Filter &= " and 单位名称 Like '%" & dwmc.text & "%'"
End If
If ksrq.Value IsNot Nothing Then
Filter = Filter & " and 日期 >= #" & ksrq.Value.Date & "#"
End If
If jsrq.Value IsNot Nothing Then
Filter = Filter & " and 日期 < #" & jsrq.Value.Date.adddays(1) & "#"
End If
Tables("查询窗口_查询").Filter = filter