是这个意思?
Dim d As Date = e.DataRow("生产日期")
d = new Date(d.Year, d.Month, 1)
Dim Amount As Double = e.DataTable.Compute("Sum(生产数量)","生产工单 = '" & e.DataRow("生产工单") & "' and 生产日期 >= #" & d & "# and 生产日期 < #" & d.AddMonths(1) & "#")
Dim dr As DataRow
dr = DataTables("生产汇总").Find("生产工单 = '" & e.DataRow("生产工单") & "'")
If dr IsNot Nothing Then
dr("生产数量") = Amount
Else
dr = DataTables("生产汇总").AddNew()
dr("生产工单") = e.DataRow("生产工单")
End If
[此贴子已经被作者于2013-12-3 20:08:19编辑过]