select * from tabel where '1'='1' & case when cmb='' then "and 学历=''" else "and 学历="cmb.text end大致是这样的。
dim StrSql as string dim strWhere as string'判断combo控件内容 if trim(combo.text)="" then strWhere="" else strWhere=" AND 学历='"& trim(combo.text) &"'" end if'构造SQL查询语句 StrSql=" SELECT * FROM 表名 WHERE 1=1 " & strWhere
dim strWhere as string'判断combo控件内容
if trim(combo.text)="" then
strWhere=""
else
strWhere=" AND 学历='"& trim(combo.text) &"'"
end if'构造SQL查询语句
StrSql=" SELECT * FROM 表名 WHERE 1=1 " & strWhere