这种问题,应该自己可以解决:
MessageBox.Show(Filter)
看看生成的表达式是什么,就知道原因了:
Dim Filter As String
With e.Form.Controls("CheckedComboBox1")
If .Value IsNot Nothing Then
Filter = Filter & "("
Dim parts() As String = .Text.Split(",")
For i As Integer = 0 To parts.Length - 1
If i > 0 Then
Filter = Filter & " Or "
End If
Filter = Filter & "销售顾问 Like '*" & parts(i) & "*'"
Next
Filter = Filter & ")"
End If
End With
With e.Form.Controls("CheckedComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "("
Dim parts() As String = .Text.Split(",")
For i As Integer = 0 To parts.Length - 1
If i > 0 Then
Filter = Filter & " Or "
End If
Filter = Filter & "客户 Like '*" & parts(i) & "*'"
Next
filter = Filter & ")"
End If
End With
messagebox.show(filter)
[此贴子已经被作者于2012-1-13 9:36:01编辑过]