vb6中利用check控件如何实现多重选择查询功能

来源:百度知道 编辑:UC知道 时间:2024/06/02 12:34:20
vb6 +access+adodb+datagrid+check 控件 如何实现 多重选择查询功能
新手学VB,请给出详细代码(最好有注解)
可再+分

字段:收入金额:money 对应控件:text1,text2,check2
收入日期:date 对应控件:combo1,combo2,check1
账户列别:type 对应控件:combo3,check3
收入来源:income 对应控件:combo4,check4
备注信息:info 对应控件:text3,check5
对应不是绑定,是为了说明我的代码。
private sub command_click()
dim constr as string
constr= "select * from 表 where "
if check1.value =1 then
constr = constr & "date > '" & combo1.text & "' and date < '" & combo2.text & "'"
end if
if check2.value =1 then
if right(trim(constr),5)<> "where" then constr = constr & "and "
constr = constr & "money > '" & right(text1.text ,len(text1.text)-1) & "' and mondy < '" & right(text2.text ,len(text2.text)-1) & "'"
end if
以下的写法都差不多
到最后一个check写完
就rec.open constr ,con
因为太麻烦,就没调试。可能有错误。

加1000分