Public Function Perebros(Iz_Tabl As String, V_Tabl As String)
'"SELECT protokol_dog.* FROM protokol_dog LEFT JOIN Vosstanov_dog ON protokol_dog.KOD = Vosstanov_dog.KOD WHERE (((Vosstanov_dog.KOD) Is Null));"
Dim fldField As Field
Dim rs_Iz_Tabl As DAO.Recordset
Dim rs_V_Tabl As DAO.Recordset
Dim rs_Zapros As DAO.Recordset
Set rs_Zapros = CurrentDb.OpenRecordset("SELECT " & Iz_Tabl & ".* FROM " & Iz_Tabl & " LEFT JOIN Vosstanov_dog ON " & Iz_Tabl & ".KOD = " & V_Tabl & ".KOD WHERE (((" & V_Tabl & ".KOD) Is Null))", dbOpenDynaset)
Set rs_Iz_Tabl = CurrentDb.OpenRecordset(Iz_Tabl, dbOpenDynaset)
Set rs_V_Tabl = CurrentDb.OpenRecordset(V_Tabl, dbOpenDynaset)
rs_Zapros.MoveFirst
With rs_Zapros
Do Until .EOF
'MsgBox !kod
rs_V_Tabl.AddNew
For Each fldField In rs_Zapros.Fields' здесь ругается тип не тот
rs_V_Tabl.Fields("kod") = !kod
Next
rs_V_Tabl.Update
.MoveNext
Loop
End With
rs_Iz_Tabl.Close
Set rs_Iz_Tabl = Nothing
rs_V_Tabl.Close
Set rs_V_Tabl = Nothing
End Function
|