以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  函数的筛选条件合成  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=63533)

--  作者:一笑
--  发布时间:2015/1/22 21:57:00
--  函数的筛选条件合成
老师请看看,最后一行合成sum函数的筛选条件有啥问题,谢谢
Dim dt1 As Date = Date.Today
Dim dt2 As Date = Date.Today.AddDays(-90)
Dim Filter As String
Filter = "日期 >= #" & dt2 & "# And 日期 <= #" & dt1 & "#"

If e.DataCol.Name = "姓名" Then
    
Dim dr As DataRow = e.DataRow
Dim sum As Double = Tables("人员任务统计").Compute("Sum([起落])", Filter & "And" & "机型1 = \'" & dr("机型1") & "\'And 姓名 = \'" & dr("姓名") & "\'")



--  作者:有点甜
--  发布时间:2015/1/22 21:58:00
--  
Dim sum As Double = Tables("人员任务统计").Compute("Sum([起落])", Filter & " And 机型1 = \'" & dr("机型1") & "\' And 姓名 = \'" & dr("姓名") & "\'")