以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  多选的时候,只显示一个,其他两个备选的不显示,应该怎么改?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=76841)

--  作者:jinzhengbe
--  发布时间:2015/11/5 23:52:00
--  多选的时候,只显示一个,其他两个备选的不显示,应该怎么改?

Dim Filter As String
With e.Form.Controls("userfin")
    If .Value IsNot Nothing Then
        Filter = "name = \'" & .Value & "\'"
    End If
End With

With e.Form.Controls("userfin1")
    If .Checked = True Then
        Filter = "状态 = \'未送\'"
    End If
End With
With e.Form.Controls("ok")
    If .Checked = True Then
        Filter = "状态 = \'ok\' "
    End If
End With
With e.Form.Controls("new")
    If .Checked = True Then
        Filter = "状态 = \'新\'"
    End If
End With


With e.Form.Controls("cmbEmployee")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "shangcheng = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "time >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "time <= #" & .Value & "#"
    End If
End With

If Filter > "" Then
    Tables("qt2").Filter = Filter
\'     Tables("weixin").Filter = Filter
End If


此主题相关图片如下:捕获.png
按此在新窗口浏览图片

 

这个图我设计的是 把选择按钮都选上的话,三个相应的结果都能出来才对,

但是现在,如果我选中 两个,或者三个的话,

 

结果只会 筛选其中的一个,代码如上 麻烦指点一下


--  作者:Hyphen
--  发布时间:2015/11/6 8:19:00
--  

Dim Filter As String = "1=1"
With e.Form.Controls("userfin")
    If .Value IsNot Nothing Then
        Filter = " name = \'" & .Value & "\'"
    End If
End With

Dim f2 As String
With e.Form.Controls("userfin1")
    If .Checked = True Then
        f2 = "状态 = \'未送\'"
    End If
End With
With e.Form.Controls("ok")
    If f2 > "" Then
        f2 = f2 & " or "
    End If
    If .Checked = True Then
        f2 &= "状态 = \'ok\' "
    End If
End With
With e.Form.Controls("new")
    If f2 > "" Then
        f2 = f2 & " or "
    End If
    If .Checked = True Then
        f2 &= "状态 = \'新\'"
    End If
End With
If f2 > "" Then
    Filter = Filter & " and (" & f2 & ")"
End If

With e.Form.Controls("cmbEmployee")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "shangcheng = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "time >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "time <= #" & .Value & "#"
    End If
End With

If Filter > "" Then
    Tables("qt2").Filter = Filter
    \'     Tables("weixin").Filter = Filter
End If