有点甜老师,我原来是按控件ComboBox建立年度项目列表,只可以查询一年的记录,比如2015年的记录,您告诉的代码如下,非常好用。
Dim Filter As String = "1=1"
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = Filter & " and 年度 = \'" & .Value & "\'"
End If
End With
Tables("信息查询表").Filter = Filter
现在我想用CheckedComboBox控件,这个控件是有复选功能,,这样就可以按照需要同时任意选择几年的记录一起看了,按原来代码这样改了一下,只能查一年,如果勾选多个确定后,就不能查询了,这种情况下代码应该是怎样,还得麻烦老师啦,谢谢!第一张截图是控件ComboBox的,只能查询一年的。第二张截图CheckedComboBox控件,想既可以查一年,也可以同时查不同年度的。
Dim Filter As String = "1=1"
With e.Form.Controls("CheckedComboBox1")
If .Value IsNot Nothing Then
Filter = Filter & " and 年度 = \'" & .Value & "\'"
End If
End With
Tables("信息查询表").Filter = Filter
此主题相关图片如下:1.jpg


此主题相关图片如下:2.jpg
