不行:我的代码是这样的:
Dim Filter As String
With e.Form.Controls("CheckedComboBox1")
Dim Vals() As String = e.Form.Controls("CheckedComboBox1").Value.Split(",")
For Val As Integer = 0 To Vals.Length - 1
If Vals(Val) IsNot Nothing Then
Filter = "客户编号 = '" & Vals(Val) & "'"
End If
Next
End With
'我的意思是红色这一部分可以做到多值选择筛选,但是万一只要选择一个值时可以跟后面的代码一起起到多重筛选.
With e.Form.Controls("CheckedComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "合同编号 = '" & .Value & "'"
End If
End With
With e.Form.Controls("DateTimePicker1")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "本期起息日 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
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
Tables("查询_Table1").Filter = Filter
End If