Dim T As String = e.form.Controls("textbox1").Value \'定义控件的值
Dim Filter As String \'定义筛选
For Each dc As Col In Tables("收款登记").Cols \'遍历表的所有列
If dc.DataCol.IsDate OrElse dc.DataCol.IsBoolean OrElse dc.DataCol.IsNumeric Then \'如果是时间列,逻辑列,数值列
Continue For \'排除
End If
If Filter > "" Then
Filter = Filter & " Or "
End If
Filter = Filter & "[" & dc.Name & "] Like \'*" & T & "*\'" \'根据控件值迷糊筛选
With e.Form.Controls("起始日期")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "收款日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("终止日期")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "收款日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("收款登记").Filter = Filter \'将数据筛选出来
End If
Next
Tables("收款登记").Filter = Filter \'将数据筛选出来
DataTables("收款登记").LoadFilter= Filter.replace("#", "\'").replace("*", "%")
DataTables("收款登记").load