Dim Filter As String
With e.Form.Controls("txtkh")
If .Value IsNot Nothing Then
Filter = "Customer like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("txtcp")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "Product like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("txtgdh")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "PNum like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("txthth")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "ContractNum like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("txtddh")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "OrderNum like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("cmbywy")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "Sales like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("startdate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "InDate >= '" & .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 & "InDate <= '" & .Value & "'"
End If
End With
If Filter > "" Then
DataTables("工单资料").Fill("Select {PNumPrintInfo}.ID,{PNumPrintInfo}.PNum,{PNumPrintInfo}.Product,PartsName,MPStyle,PaperName,PrintScale,PrintColor,PrintColorDes,PCount,LCount,TotalCount,DevName,MScale,MPCount,Customer,ContractNum,InDate,OrderNum,Sales Fro m {PNumPrintInfo} Inner JOIN {PNumSumInfo} ON {PNumSumInfo}.[PNum] = {PNumPrintInfo}.[PNum] Where Filter Order By InDate desc", "xunyue", True)
End If
此主题相关图片如下:测试.png

[此贴子已经被作者于2018/10/24 17:16:31编辑过]