搞得有点晕,请将进货表的数量列改成数值型。
If e.DataCol.Name = "A" Then Dim Str As String Dim r As Row = CurrentTable.Current Dim dr,dr1 As DataRow Dim sum1,sum2 As Double Str = "[商品名称] = '" & r("商品名称") & "' And [规格] = '" & r("规格") & "'" dr = DataTables("库存表").Find(Str) sum1 = Tables("进货表").Compute("Sum(数量)", Str) sum2 = Tables("进货表").Compute("Sum(金额)", Str) If e.NewValue = True Then dim y As New Filler y.SourceTable = DataTables("进货表") y.SourceCols = "ID,日期,商品名称,代码,规格,数量,单价,金额,客户" y.DataTable = DataTables("库存表") y.DataCols = "ID,日期,商品名称,代码,规格,数量,单价,金额,客户" y.ExcludeExistValue = true y.Filter = "[A] = true" y.Fill() if dr IsNot Nothing Then dr("数量") = sum1 dr("金额") = sum2 End If Else dr1 = DataTables("进货表").Find(Str & " And [A] = true") if dr1 Is Nothing Then DataTables("库存表").DeleteFor(Str) End If End If End If
|