此主题相关图片如下:2.png
老师好,为了能动态组合对表进行筛选,请查看一下我设计的思路.
With e.Form.Controls("所报学科")
If .Value IsNot Nothing Then
If _Filter > "" Then
_Filter = _Filter & " And "
End If
_Filter = _Filter & "所报学科 = '" & .Value & "'"
End If
End With
MessageBox.show(_filter)
If _Filter > "" Then
Tables("报名缴费").Filter = _Filter
End If
_filter=_filter.TrimEnd(" And 所报学科 = '" & e.Form.Controls("所报学科").Value & "'")
MessageBox.show(_filter)
问题是,每一次要更换“所报学科”的value值后,_filter值 都会叠加,我设计的是加载成功能去掉后同的那些字符,这样再选择“所报学科”后,就不担心不成功了!
此主题相关图片如下:1.png