有“村干部基本信息表”和“考核”表,都有村干部编号和姓名列,“考核”表跨表引用“村干部基本信息”表数据,“村干部基本信息”表“村干部编号”列不重复,“姓名”列可重复,“考核”表姓名列遇到重复的姓名时,自动生成在“村干部基本信息”表对应的“村干部编号”会有多个,想要实现提供选项供人选择到底是哪个编号怎么实现?“考核”表的DataColChanged事件现有代码如下:
If e.DataCol.Name = "村干部编号" Then
If e.NewValue Is Nothing Then
e.DataRow("姓名") = Nothing
Else
Dim dr As DataRow
dr = DataTables("村干部基本信息").Find("[村干部编号] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("姓名") = dr("姓名")
End If
End If
End If
If e.DataCol.Name = "姓名" Then
If e.NewValue Is Nothing Then
e.DataRow("村干部编号") = Nothing
Else
Dim dr As DataRow
dr = DataTables("村干部基本信息").Find("[姓名] = '" & e.NewValue & "'")
If dr IsNot Nothing Then
e.DataRow("村干部编号") = dr("村干部编号")
End If
End If
End If
请老师指导这段该怎么修改?
[此贴子已经被作者于2019/8/14 17:17:58编辑过]