这个我是放在窗口事件中的文本改变后执行,相当于每输入一个字就会筛选,经常碰到按一个字要卡个半秒一秒
Select Case e.Sender.Name
Case "业务员", "客户", "花号", "色位", "面料", "打印机台", "调色员", "调色完成", "调完起始", "调完结束"
Dim Filter As String
With e.Form.Controls("业务员")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "业务员 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("客户")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "客户 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("花号")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "花号 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("色位")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "色位 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("面料")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "面料 like '%" & .text.replace("*", "[*]") & "%'"
End If
End With
With e.Form.Controls("打印机台")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "打印机台 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("调色员")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调色员 like '%" & .text & "%'"
End If
End With
With e.Form.Controls("调完起始")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调完日期 >= #" & .text & "#"
End If
End With
With e.Form.Controls("调完结束")
If .text > "" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调完日期 <= #" & .text & "#"
End If
End With
If e.Form.Controls("调色完成").Text = "·" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调色完成 = false"
End If
If e.Form.Controls("调色完成").Text = "调完" Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "调色完成 = true"
End If
If Filter > "" Then
Tables("计划").Filter = Filter
End If
End Select