代码是Dim Filter As StringWith e.Form.Controls("店铺名称")
If .Value IsNot Nothing Then
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
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
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 Filter > "" Then
Tables("查询表").Filter = Filter
End If