Dim Filter As String
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Filter = Filter & " And "
End If
Dim c As String = e.Form.Controls("ComboBox1").Text
Dim d As String = " " & e.Form.Controls("ComboBox2").Text & " "
Dim 符号 As String
If d = " like " Then
If tbl.Cols(c).IsString = False Then
Filter = Filter & "convert(" & c & ",'System.String')" & d & "'%" & e.Form.Controls("TextBox1").Text & "%'"
Else
Filter = Filter & c & d & "'%" & e.Form.Controls("TextBox1").Text & "%'"
End If
Else
If tbl.Cols(c).IsString Then
符号 = "'"
ElseIf tbl.Cols(c).IsDate Then
符号 = "#"
End If
Filter = Filter & c & d & 符号 & e.Form.Controls("TextBox1").Text & 符号
End If
Tables("模糊查询_订单").Filter = Filter