老师,我用多条件求和(如图1),代码如下,求出来后,我把使用类型清空后,计算的结果:“加工数量”不清空(如图2),因为条件都不全的,正常的话"加工数量"的结果应该要清空才对!
If e.DataRow("使用类型") = "按设备算" Then
If e.DataCol.Name = "使用设备" Or e.DataCol.Name = "月份" Then
If e.DataRow.isnull("使用设备") OrElse e.DataRow.isnull("月份") Then
e.DataRow("加工数量") = Nothing
Else
e.DataRow("加工数量") = DataTables("工序跟踪表").sqlCompute("sum(加工时间)", "[使用设备] = '" & e.DataRow("使用设备") & "' and 月份 = '" & e.DataRow("月份") & "'")
End If
End If
Else
If e.DataCol.Name = "月份" Then
If e.DataRow.isnull("月份") Then
e.DataRow("加工数量") = Nothing
Else
e.DataRow("加工数量") = DataTables("工序跟踪表").sqlCompute("sum(加工时间)", "[月份] = '" & e.DataRow("月份") & "'")
End If
End If
End If

此主题相关图片如下:1.jpg


此主题相关图片如下:2.jpg
