用代码的方式统计
e.DataRow("销售期_罐数") = DataTables("表A").Compute("sum(数量)", "日期 >= #" & Date.Today.AddMonths(-3) & "# and 品名 = '" & e.DataRow("品名") & "'")
e.DataRow("警示期_罐数") = DataTables("表A").Compute("sum(数量)", "日期 < #" & Date.Today.AddMonths(-3) & "# and 日期 >= #" & date.Today.AddMonths(-6) & "# and 品名 = '" & e.DataRow("品名") & "'")
e.DataRow("危险期_罐数") = DataTables("表A").Compute("sum(数量)", "日期 < #" & Date.Today.AddMonths(-6) & "# and 品名 = '" & e.DataRow("品名") & "'")
http://www.foxtable.com/webhelp/scr/0681.htm