以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  textbox问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=121272)

--  作者:有点甜
--  发布时间:2018/7/3 9:17:00
--  
Dim nd As String = "2018"
Dim yf As String = "七月"
Dim kh As String = "abc"
Dim filter As String = "1=1"
If nd > "" AndAlso yf > "" Then
    Dim ary() = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"}
    Dim d As Date = new Date(nd, ary.Indexof(ary, yf.trim("月"))+1, 1)
    filter &= " and 日期 >= #" & d & "# and 日期 < #" & d.addmonths(1) & "#"
End If
If kh > "" Then
    filter &= " and 客户 = \'" & kh & "\'"
End If
msgbox(filter)
\'然后写compute查询各个表数据
\'Dim sum As Double = DataTables("表A").compute("sum(金额)", filter)

--  作者:有点甜
--  发布时间:2018/7/3 16:03:00
--  

红色改成你订单主表的日期列的列名

 

filter &= " and 日期 >= #" & d & "# and 日期 < #" & d.addmonths(1) & "#"


--  作者:有点蓝
--  发布时间:2018/7/3 20:31:00
--  
把【编程基础】和【Foxtable编程】这2章内容,完整过几遍
--  作者:有点蓝
--  发布时间:2018/7/3 23:00:00
--  
按5楼的方式改呀,还有什么问题?
--  作者:有点甜
--  发布时间:2018/7/4 9:17:00
--  
Dim nd As String = "2018"
Dim yf As String = "七月"
Dim kh As String = "abc"
Dim filter As String = "1=1"
If nd > "" AndAlso yf > "" Then
    Dim ary() = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"}
    Dim d As Date = new Date(nd, ary.Indexof(ary, yf.trim("月"))+1, 1)
    filter &= " and 订单日期 >= #" & d & "# and 订单日期 < #" & d.addmonths(1) & "#"
End If
If kh > "" Then
    filter &= " and 客户名称 = \'" & kh & "\'"
End If
msgbox(filter)
Dim sum As Double = DataTables("订单主表").compute("sum(总金额)", filter)
msgbox(sum)