RecordsetClone is one way. I always name subform container different from the object it holds, like ctrDetails. Code behind button on main form:
Code:
Private Sub btnImport_Click()
If Me.ctrDetails.Form.Dirty Then Me.ctrDetails.Form.Dirty = False 'make sure records are committed to table
With Me.ctrDetails.Form.RecordsetClone
While Not .EOF
If IsNull(DLookup("PONumber", "POTable", "PONumber='" & .PONumber & "'")) Then
CurrentDb.Execute "INSERT INTO POTable SELECT * FROM TempPO WHERE PONumber='" & .PONumber & "'"
MsgBox "New PO added."
Else
MsgBox "PO already exists"
End If
.MoveNext
Wend
End With
End Sub
This requires the subform container hold a form. If the container holds a table or query, RecordsetClone will not work and you will have to open a recordset object that pulls directly from table.
Code can also physically move to each record of form. This movement will be visible to user.