老师,我想再增加一个复制条件列名称为“房屋主体”,谢谢老师。
If e.DataCol.Name = "项目" Then
If e.DataRow.IsNull("项目") = False AndAlso e.DataRow.IsNull("抄表日期") = False Then
Dim dr1 As DataRow = e.DataTable.Find("项目='" & e.NewValue & "' and 抄表日期 is not null and _sortkey <" & e.DataRow("_sortkey"),"_sortkey desc")
If dr1 IsNot Nothing Then
e.DataRow("分表上期") = dr1("分表本期")
[此贴子已经被作者于2025/3/25 15:18:42编辑过]
老师,不是黄标出的这个意思,我是想再增加一个条件判断即:“项目”和”房屋主体”,如红色标出的判断的代码。
If e.DataCol.Name = "项目" Then
Dim dr1 As DataRow = e.DataTable.Find("项目='" & e.NewValue & "' and 房屋主体='xxx' and 抄表日期 is not null and _sortkey <" & e.DataRow("_sortkey"),"_sortkey desc")
[此贴子已经被作者于2025/3/25 15:50:29编辑过]

此主题相关图片如下:2025-03-17 12 19 54.png

If e.DataCol.Name = "项目" Then
If e.DataRow.IsNull("项目") = False AndAlso e.DataRow.IsNull("抄表日期") = False Then
Dim dr1 As DataRow = e.DataTable.Find("项目='" & e.NewValue & "' and 抄表日期 is not null and _sortkey <" & e.DataRow("_sortkey"),"_sortkey desc")
If dr1 IsNot Nothing Then
e.DataRow("一号楼_上期") = dr1("一号楼_本期")
Dim dr1 As DataRow = e.DataTable.Find("项目='" & e.NewValue & "' and 房屋主体='" & e.DataRow("房屋主体") & "' and 抄表日期 is not null