改成这样
For each dr1 As DataRow in DataTables("第一个表").datarows
Dim dr2 As datarow = DataTables("第二个表").Find("姓名 = '" & dr1("姓名") & “' and 工作单位 = '" & dr1("工作单位") & "'")
if dr2 IsNot Nothing Then
Dim dr3 As Datarow = Datatables("第三个表").AddNew()
dr3("工作单位") = dr1("工作单位")
dr3("姓名") = dr1("姓名")
dr3("卡余额") = dr1("卡余额")
dr3("会员卡号") = dr1("会员卡号")
else
Dim dr4 As Datarow = Datatables("第四个表").AddNew()
dr4("工作单位") = dr1("工作单位")
dr4("姓名") = dr1("姓名")
dr4("卡余额") = dr1("卡余额")
end If
Next