If e.DataCol.Name = "项目名称" Then '如果更改的是身份证号码列
If e.DataRow.IsNull("项目名称") Then '身份证号码是否为空
e.DataRow("项目代码") = Nothing '如果为空,则清除出生日期
Else
Dim dr As DataRow
dr = DataTables("表A").Find("项目名称 = " & "'" & e.DataRow("项目名称") & "'" )
If dr IsNot Nothing '如果找到, 则设置各列内容
e.DataRow("项目代码")= dr("项目编号")
End If
End If
End If
If e.DataCol.Name = "项目名称" Then '如果更改的是身份证号码列
If e.DataRow.IsNull("项目名称") Then '身份证号码是否为空
e.DataRow("项目代码") = Nothing
e.DataRow("档案序号") = Nothing
Else
e.DataRow("档案序号")= e.DataRow("项目代码") & Format(e.DataTable.Compute("Count(项目名称)","[项目名称] = '" & e.DataRow("项目名称") & "' And [_identify] < 100" & e.DataRow("_Identify")),"000")
End If
End If
是不是这样?