Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
组合框源代码如下:(支持模糊查询的)
Dim Filter As String
With e.Form.Controls("CheckedComboBox3")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "销售顾问 Like '*" & .Value & "*'"
End If
End With
With e.Form.Controls("CheckedComboBox1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "客户来源 Like '*" & .Value & "*'"
End If
End With
With e.Form.Controls("CheckedComboBox2")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "欲购车型 Like '*" & .Value & "*'"
End If
End With
With e.Form.Controls("CheckedComboBox4")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "意向级别 Like '*" & .Value & "*'"
End If
End With
With e.Form.Controls("DateTimePicker9")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "建档日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker10")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "建档日期 <= #" & .Value & "#"
End If
End With
Tables("销售意向客户进度管制").filter = filter
老大 你这个针对一个组合复选框 很不错 但是 我项目上 是多个组合复选框 复选框与复选框之间不是or 而是and 该怎么加啊?
自己之间用Or,相互之间用And:
Dim Filter As String
With e.Form.Controls("CheckedComboBox1")
If .Value IsNot Nothing Then
Filter = Filter & "("
Dim parts() As String = .Text.Split(",")
For Each part As String In parts
If Filter >"" Then
Filter = Filter & " Or "
End If
Filter = Filter & "销售顾问 Like '*" & part & "*'"
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 Each part As String In parts
If Filter >"" Then
Filter = Filter & " Or "
End If
Filter = Filter & "客户 Like '*" & part & "*'"
Next
filter = Filter & ")"
End If
End With
messagebox.show(filter)
这种问题,应该自己可以解决:
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)
请教贺老师,五楼代码中这句 “ Filter = Filter & "(" ”含义是什么
请教何老师,五楼代码中这句 “ Filter = Filter & "(" ”含义是什么
用:
messagebox.show(filter)
就知道原因是什么了。