现有3个筛选参数a、b、c,这三个参数前分别有3个ChecBox-chba、chbb、chbc,哪个参数作为筛选条件,由其对应的CheckBox的值确定。最终的筛选条件为动态合成。我是这样写的:
dim fa as string="参数1='" & a &"'"
dim fb as string="参数2='" & b &"'"
dim fc as string="参数3='" & c &"'"
if chba.checked= false then
fa =nothing
end if
if chbb.checked= false then
fb =nothing
end if
if chbc.checked= false then
fc =nothing
end if
Tables("表1").Filter=fa& " and " & fb & " and " & fc
运行结果:如果都3个checkbox的值都为true,不提示错误,如果有一个为false,则提示下图错误。
此主题相关图片如下:截图00.png
不知要实现这种目的,需要如何操作。