以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  窗口编码问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=87230)

--  作者:feixianzhi
--  发布时间:2016/7/6 10:37:00
--  窗口编码问题

图片点击可在新窗口打开查看此主题相关图片如下:qq截图20160706103353_看图王.png
图片点击可在新窗口打开查看
请各位大师帮忙,怎么编码。谢谢。

--  作者:feixianzhi
--  发布时间:2016/7/6 10:39:00
--  
查询条件不一定全部输入,但商品名称肯定要输入的,其它的不是必填的,但有可能填。


--  作者:大红袍
--  发布时间:2016/7/6 10:40:00
--  

参考

 

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

 


--  作者:feixianzhi
--  发布时间:2016/7/6 10:47:00
--  
大红袍老师,这个帮助是在原表中筛选。我想在这个查询表中,输入条件,直接就出数量。麻烦您了。
--  作者:大红袍
--  发布时间:2016/7/6 10:53:00
--  

 一样啊,参考3楼,得到条件,然后统计数量

 

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

 


--  作者:feixianzhi
--  发布时间:2016/7/6 11:17:00
--  
Dim Filter As String
With e.Form.Controls("spmc")
    If .Value IsNot Nothing Then
        Filter = "商品名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("gys")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "供应商名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("scqy")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "生产企业 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("khmc")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "客户名称 = \'" & .Value & "\'"
    End If
End With

With e.Form.Controls("qsrq")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "会计日 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("jsrq")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "会计日 <= #" & .Value & "#"
    End If
End With
If Filter > "" Then
    Tables("批发及退货报表2016").Filter = Filter
End If

大红袍老师,以上编码是点击开始筛选在批发及退货报表中筛选。我现在怎么做能实现我问的。

--  作者:大红袍
--  发布时间:2016/7/6 11:20:00
--  

最后写

 

e.Form.Controls("TextBox1").Text = DataTables("批发及退货报表2016").Compute("sum(数量)", Filter)


--  作者:feixianzhi
--  发布时间:2016/7/6 11:27:00
--  
麻烦大红袍老师,我以前是把代码放在开始筛选的按钮的事件中。现在我应该把代码放在哪呀。
--  作者:大红袍
--  发布时间:2016/7/6 11:29:00
--  
窗口TextChanged或者ValueChanged事件。
--  作者:feixianzhi
--  发布时间:2016/7/6 13:18:00
--  
Dim Filter As String
With e.Form.Controls("spmc")
    If .Value IsNot Nothing Then
        Filter = "商品名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("gys")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "供应商名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("scqy")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "生产企业 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("khmc")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "客户名称 = \'" & .Value & "\'"
    End If
End With

With e.Form.Controls("qsrq")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "会计日 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("jsrq")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "会计日 <= #" & .Value & "#"
    End If
End With
If Filter > "" Then
    Tables("批发及退货报表2016").Filter = Filter
End If

e.Form.Controls("TextBox1").Text = DataTables("批发及退货报表2016").Compute("sum(数量)", Filter)


大红袍老师,以上代码。统计的数量是此商品名称的全部数量,而不是又加其他条件的数量。我的编码哪错了。