要求每次新增一行(一个记录)后,以下三个日期自动从同列中的最大日期取数加一个月自动填写
现在问题是:在重置相关列时出现错误,特别在重置cpbm列时,三个日期变化成又加了一个月并更新原有的所有行
每重置一次,加一个月了。晕死了
我目的是:已经保存的列不参与重新计算或者第一行(日期最小的行)不参与计算。其他行可以计算,但是数据不用变化啊,只变化新增的行嘛
If e.DataCol.Name = "cpbm" Then
If e.DataRow.IsNull("cpbm") OrElse e.DataRow.IsNull("fxfs") Then
e.DataRow("fxrq") = Nothing
e.DataRow("qxrq") = Nothing
e.DataRow("zxrq") = Nothing
Else
If e.DataRow("fxfs")= "按月实际天数付" Then
Dim ddr0 As DataRow
Dim max As Date
max = e.DataTable.Compute("Max(zxrq)")
ddr0 = DataTables("dk_lxb").Find("[cpbm] = '" & e.DataRow("cpbm") & "'","zxrq desc")
If ddr0 IsNot Nothing
Dim zx1 As Date = ddr0("zxrq") '止息日期
Dim zx2 As Date = zx1.addmonths(1) '第二次止息日期
Dim fx1 As Date = ddr0("fxrq")
Dim fx2 As Date = fx1.addmonths(1)
Dim qx1 As Date = ddr0("qxrq")
Dim qx2 As Date = qx1.addmonths(1)
e.DataRow("zxrq") = zx2
e.DataRow("fxrq") = fx2
e.DataRow("qxrq") = qx2
End If
End If
End If
End If
[此贴子已经被作者于2020/4/30 9:14:58编辑过]