以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  查询结果不符合要求  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=116866)

--  作者:zbdxnyy
--  发布时间:2018/4/1 19:42:00
--  查询结果不符合要求
为什么输入“小白”和“进口”会出现表中结果,查询按钮事件代码如下
Dim Filter As String
Dim myfs As winForm.TextBox=e.Form.Controls("贸易方式")
If myfs.Value IsNot Nothing Then
Filter = " 贸易方式=\'"& myfs.Value &"\'"
End If
Dim khmc As winForm.TextBox=e.Form.Controls("客户名称")
If khmc.Value IsNot Nothing Then
 Filter =" 客户名称=\'"& khmc.Value &"\'"
End If
Dim khzh As winForm.TextBox=e.Form.Controls("客户账户")
If khzh.Value IsNot Nothing Then
Filter =" 客户账户=\'"& khzh.Value &"\'"
End If
Dim hth As winForm.TextBox=e.Form.Controls("合同号")
If hth.Value IsNot Nothing Then
 Filter = " 合同号=\'"& hth.Value &"\'"
End If
If Filter > "" Then
 Tables("记录表
图片点击可在新窗口打开查看此主题相关图片如下:微信图片_20180401192540.png
图片点击可在新窗口打开查看
").Filter=Filter


--  作者:有点甜
--  发布时间:2018/4/1 20:17:00
--  

代码这样写

 


Dim Filter As String = "1=1"
Dim myfs As winForm.TextBox=e.Form.Controls("贸易方式")
If myfs.Value IsNot Nothing Then
    Filter &= "  and 贸易方式=\'"& myfs.Value &"\'"
End If
Dim khmc As winForm.TextBox=e.Form.Controls("客户名称")
If khmc.Value IsNot Nothing Then
    Filter &=" and 客户名称=\'"& khmc.Value &"\'"
End If
Dim khzh As winForm.TextBox=e.Form.Controls("客户账户")
If khzh.Value IsNot Nothing Then
    Filter &=" and 客户账户=\'"& khzh.Value &"\'"
End If
Dim hth As winForm.TextBox=e.Form.Controls("合同号")

If hth.Value IsNot Nothing Then
    Filter &= " and 合同号=\'"& hth.Value &"\'"
End If
Tables("记录表").Filter=Filter


--  作者:有点甜
--  发布时间:2018/4/1 20:18:00
--  

http://www.foxtable.com/webhelp/scr/1058.htm