以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  查询  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=50620)

--  作者:qq864729713
--  发布时间:2014/5/9 20:59:00
--  查询
如果我加入牌子类别,这个代码需要怎么 就算产品名称和类别为一个查询, 牌子和牌子类别为一个查询 
麻烦
Dim cpmc As WinForm.TextBox = e.Form.Controls("产品名称")
Dim lb As WinForm.ComboBox = e.Form.Controls("类别")
Dim pz As WinForm.ComboBox = e.Form.Controls("牌子")

Dim pzlb As WinForm.ComboBox = e.Form.Controls("牌子类别")

Dim Filter As String = "1=1"
With e.Form.Controls("产品名称")
    If .Value IsNot Nothing Then
        Filter &= " and 产品名称 like \'*" & cpmc.text & "*\'"
    End If
End With
With e.Form.Controls("类别")
    If .Value IsNot Nothing Then
        Filter &= " and 类别 =\'" & lb.text & "\'"
    End If
End With
With e.Form.Controls("牌子")
    If .Value IsNot Nothing Then
        Filter &= " and 牌子 =\'" & pz.text & "\'"
    End If
End With
With e.Form.Controls("牌子类别")
    If .Value IsNot Nothing Then
        Filter &= " and 牌子类别 =\'" & pzlb.text & "\'"
    End If
End With
If Filter > "" Then
    Tables("产品明细表").Filter = Filter
End If


If Filter > "" Then
    e.Form.Controls("添加产品").Table.Filter = Filter
End If

[此贴子已经被作者于2014-5-9 21:21:18编辑过]

--  作者:qq864729713
--  发布时间:2014/5/10 11:44:00
--  
可以了。