那改一下代码就可以了吧。
DataTables("坯布统计").DataRows.Clear() '清除原来的数据 For Each nm As String In DataTables("坯布输入").GetUniqueValues("","产品名称") Dim dr As DataRow = DataTables("坯布统计").AddNew() Dim ft As Date = new Date(Date.Today.Year,Date.Today.Month,1) dr("年") = dr("年") dr("月") = dr("月") dr("产品名称") = nm dr("长度_本日") = DataTables("坯布输入").compute("Sum(长度)","产品名称 = '" & nm & "' and 日期 = #" & Date.Today & "#")
dr("长度_累计") = DataTables("坯布输入").compute("Sum(长度)","产品名称 = '" & nm
& "' and 日期 >= #" & ft & "# And 日期 <= #" &
Date.Today & "#") dr("重量_本日") = DataTables("坯布输入").compute("Sum(重量)","产品名称 = '" & nm & "' and 日期 = #" & Date.Today & "#")
dr("重量_累计") = DataTables("坯布输入").compute("Sum(重量)","产品名称 = '" & nm
& "' and 日期 >= #" & ft & "# And 日期 <= #" &
Date.Today & "#") Next
|