我按照你的方法把代码改后,有新的问题,只能精确查询,不能模糊查询
这是精确查询的代码:
Dim Filter As String
With e.Form.Controls("TextBH")
If .Value IsNot Nothing Then
Filter = "版号 = '" & .Value & "'"
End If
End With
With e.Form.Controls("Textpm")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "品名 = '" & .Value & "'"
End If
End With
DataTables("产品信息查询表").LoadFilter = Filter
DataTables("产品信息查询表").Load()
这是模糊查询的代码:
Dim Filter As String
With e.Form.Controls("TextBH")
If .Value IsNot Nothing Then
Filter = "版号 like '*" & .Value & "*'"
End If
End With
With e.Form.Controls("Textpm")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "品名 like '*" & .Value & "*'"
End If
End With
DataTables("产品信息查询表").LoadFilter = Filter
DataTables("产品信息查询表").Load()