Dim Filter As String
With e.Form.Controls("业务员")
If .text IsNot Nothing Then
Filter = "业务员 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("客户")
If .text IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "客户 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("花号")
If .text IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "花号 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("面料")
If .text IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "面料 like '%" & .text.replace("*","[*]") & "%'"
End If
End With
With e.Form.Controls("调色员")
If .text IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调色员 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("打印机台")
If .text IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "打印机台 like '%" & .text & "%'"
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
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 e.Form.Controls("已完成").Checked = True ' 如果付款状态选择了"已付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "完成 = True"
End If
If e.Form.Controls("未完成").Checked = True ' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "完成 = False Or 完成 Is Null"
End If
If Filter > "" Then
Tables("调色计划").Filter = Filter
End If
这部分代码中,筛选带"盛"字的客户时会找不出来,如果我去掉 打印机台 那部分代码就能筛选出来