以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  查询窗口中的复选框该如何写  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=90195)

--  作者:dengzhihao
--  发布时间:2016/9/7 14:45:00
--  查询窗口中的复选框该如何写
查询窗口 有1个CheckBox复选框,查询按钮该如何写这代码?
--  作者:有点蓝
--  发布时间:2016/9/7 14:55:00
--  
贴出按钮代码,说明复选框代表什么字段
--  作者:dengzhihao
--  发布时间:2016/9/7 15:10:00
--  
查询窗口就是参考这个的
http://www.foxtable.com/webhelp/scr/1058.htm
因为没有复选框的参考,对代码又不熟悉,所以不会写。

If e.Form.Controls("CheckBox1").CheckBox = True 
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "已割框 = \'" & .Value & "\'"
    End If
End If

--  作者:有点蓝
--  发布时间:2016/9/7 15:14:00
--  
3楼的代码就是,不会就上传例子
--  作者:dengzhihao
--  发布时间:2016/9/7 15:33:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:wind.table


120推拉  那个查询窗口  查询按钮

--  作者:有点蓝
--  发布时间:2016/9/7 16:00:00
--  
Dim Filter As String
With e.Form.Controls("dingdanbianhao")
    If .Value IsNot Nothing Then
        Filter = "订单编号 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("kehumingchen")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "客户名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("yanse")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "颜色 = \'" & .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 & "下单日期 >= #" & .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 & "下单日期 <= #" & .Value & "#"
    End If
End With

If Filter >"" Then
    Filter = Filter & " And "
End If
Filter = Filter & " 已割框 = " & e.Form.Controls("yigekuang").checked

If Filter > "" Then
    Tables("T120").Filter = Filter
End If

--  作者:dengzhihao
--  发布时间:2016/9/7 16:08:00
--  
谢谢蓝老师!
--  作者:dengzhihao
--  发布时间:2016/9/8 15:45:00
--  
今日发现蓝老师的代码有问题,除了“已割框”可以查询外,其它都不无法查询
--  作者:有点蓝
--  发布时间:2016/9/8 16:06:00
--  
之前的例子测试没有问题,如果改过代码。请重新上传可以测试的例子
--  作者:dengzhihao
--  发布时间:2016/9/8 16:15:00
--  
我确实是加多了一个复选框,我将代码改成下面这样,除了复选框起效,其它都不起效了。

Dim Filter As String
With e.Form.Controls("dingdanbianhao")
    If .Value IsNot Nothing Then
        Filter = "订单编号 = \'" & .Value & "\'"
    End If
End With

With e.Form.Controls("kehumingchen")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "客户名称 = \'" & .Value & "\'"
    End If
End With

With e.Form.Controls("yanse")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "颜色 = \'" & .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 & "下单日期 >= #" & .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 & "下单日期 <= #" & .Value & "#"
    End If
End With

If Filter >"" Then
    Filter = Filter & " And "
End If
Filter = Filter & " 已割框 = " & e.Form.Controls("yigekuang").checked

If Filter >"" Then
    Filter = Filter & " And "
End If
Filter = Filter & " 已割扇 = " & e.Form.Controls("yigeshan").checked

If Filter > "" Then
    Tables("T88").Filter = Filter
End If