For Each v As String In DataTables("表A").GetValues("批次")
For Each dr As DataRow In DataTables("汇总").DataRows
If dr.IsNull("编号") Then
dr("批次_" & v) = Nothing
Else
Dim pr As DataRow = DataTables("表A").Find("编号 = '" & dr("编号") & "' And 批次 = '"& v &"'")
If pr IsNot Nothing Then
If pr.IsNull("缺勤类别")=False Then
dr("批次_" & v) = pr("缺勤类别")
End If
End If
End If
Next
Next
MainTable = Tables("汇总")