这里日期使用模糊查询没有意义
Dim filter As String
Dim sts () As String = {"客户","订单号码","销售员","客户订单"}
For Each st As String In sts
Dim val As String = e.Form.Controls(st).value
If val > "" Then '如果不是空
Val = val.replace("*","[*]") '把"*" 符号变成字符才能使用
If filter = "" Then
filter = st & " like '*" & val & "*'"
Else
filter = filter & " and " & st & " like '*" & val & "*'"
End If
End If
Next
With e.Form.Controls("开始日期")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "开始日期 >= #" & .Value & "#"
End If
End With
……