For Each dr As Row In Tables("表A").Rows If dr("字段2") = dr("字段3") Then Dim flag = True For Each ddr As DataRow In DataTables("表B").SQLSelect("字段1='" & dr("字段1") & "'") If ddr("字段2") <> ddr("字段3") Then flag = False Exit For End If Next If flag = True Then dr("字段5") =1 End If End If Next