I tried to make a button which would execute the next code.
Code:
PrivateSub cmdOrder_Click()Dim strSQL AsStringr
strSQL ="INSERT INTO StockMovement (ID_Product, Status, Quantity, ID_PurchaseOrder) VALUES ("& _
Me.frmPurchaseOrderDetails_Subform.Form!comboboxProduct &", '"& _
Me!txtStatus &"', "& _
Me.frmPurchaseOrderDetails_Subform.Form!txtQuantity &", "& _
Me!txtID_PurchaseOrder &");"
DoCmd.RunSQL strSQL
Me.Requery
EndSub
The code was supposed to copy records from my main form Purchase Orders and the sub-form Purchase Order Details which is in the main form and add them to the target table StockMovements. It works but it adds only the first record of the sub-form to the table. What I wanted was to copy all the records from the sub-form to the table and not just the first one. To be more clear, when I open the main form Purchase Orders, in its sub-form there will be all the products ordered with that Purchase order. Then I researched a bit and got a suggestion to try the next code
Code:
Dim strSQL AsString
strSQL =""
ForEachItemInGroup
strSQL = strSQL &"INSERT INTO table (field1,field2) VALUES (value1,value2)"Next
So I implemented it and got this
Code:
Private Sub cmdOrder_Click()
Dim strSQL As String
strSQL = ""
For Each Item In Group
strSQL = strSQL & "INSERT INTO StockMovement (ID_Product, Status, Quantity, ID_PurchaseOrder) VALUES (" &
Me.frmPurchaseOrderDetails_Subform.Form!comboboxProduct & ", '" &
Me!txtStatus & "', " &
Me.PurchaseOrderDetails_Subform.Form!txtQuantity & ", " &
Me!txtID_PurchaseOrder & ");"
Next
DoCmd.RunSQL strSQL
Me.Requery
End Sub
However, when I run it i get the runtime error "13 ", "Type mismatch". When I go to debug it makes the "For Each Item In Group" yellow.
I was thinking to add a check box in the sub-form and when its checked to run the first code, so I would have to check every item in the sub-form, but I dont know how to select the values from the main form in VBA, got a lot of errors 
Last suggestion I got was
you need a select
query or - much faster - use DAO to open the target table as a recordset and then, as source, loop the RecordsetClone of your subform and copy the records to the target table one by one
But I dont know how to implement that, if someone got an example of it, it would be awesome.
Thanks again n sorry for bothering 
Edit: I managed to add the check box in the subform and make the code work for it
However, I still would prefer one button doing all that because its not so good that I have to check every item in the list