Dim Filter As String
With e.Form.Controls("textbox1")
If .Value IsNot Nothing Then
Filter = "chanpinid = '" & .Value & "'"
End If
End With
With e.Form.Controls("textbox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "chanpinname like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("textbox3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "guige like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("textbox4")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "danwei like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("textbox5")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "chuhuodate >= #" & .Value & "#"
End If
End With
With e.Form.Controls("textbox6")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "chuhuodate <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("chuhuo").Filter = Filter
End If