一个资产管理系统,见附件:
需要按照:是否在库、资产类别、资产名称、供货商、入库和出库时间段来查询,查询某些条件可以不输入
我写的代码如下:
Dim sfzk As WinForm.CheckBox = e.Form.Controls("是否在库")
Dim zclx As WinForm.ComboBox = e.Form.Controls("资产类型")
Dim zcmc As WinForm.ComboBox = e.Form.Controls("资产名称")
Dim ghs As WinForm.ComboBox = e.Form.Controls("供货商")
Dim kssj As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim jssj As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2")
Tables("入库明细表").Filter="资产类型='"& zclx.text &"' and 资产名称='"& zcmc.text &"' and 供货商名称='"& ghs.text &"'and 购买日期 >= # " & kssj.value & " # and 购买日期 <= # " & jssj.value & " # and 是否在库="& sfzk.Checked
但是这样写的话,必须所有条件全部满足才能查询出结果,将and改为or效果也不好!
希望的效果是,当是否在库、供货商名称、资产类别任意字段不输入值是,能手查询出不带这个条件的结果
此主题相关图片如下:无标题.png