If e.DataCol.Name = "色号" OrElse e.DataCol.Name = "规格" Then if e.DataRow("色号") = Nothing OrElse e.DataRow("规格") = Nothing e.DataRow("库存量") = Nothing Else e.DataRow("库存量") = DataTables("A表").Compute("Sum(进仓数量)","[色号] = '" & e.DataRow("色号") & "' And [规格] = '" & e.DataRow("规格") & "'") End If End If