I created a button as shown in the Access Developer 24 course. I have it working to create a copy of the fields of parent and with one child table. However, I have two children tables that I need to copy the fields from to create a new record. This is my code. 'copy the Purchase Order Details and Fundsource Details detail ()
Set rsOld = CurrentDb.OpenRecordset("SELECT * FROM tbl_PurchaseOrdJunction, tbl_FundJunction WHERE ID_BlueTag=" & ID_BlueTag) 'Pull data from the junction table not the PO Table Set rsNew = CurrentDb.OpenRecordset("tbl_PurchaseOrdJunction, tbl_FundJunction") 'Pull data from the junction table not the PO Table While Not rsOld.EOF rsNew.AddNew For Each Fld In rsOld.Fields If Fld.Name = "ID_BlueTag" Then rsNew!ID_BlueTag = NewID ElseIf Fld.Name <> "tbl_PurchaseOrdJunction, tbl_FundJunction" Then rsNew(Fld.Name) = rsOld(Fld.Name) End If Next rsNew.Update rsOld.MoveNext Wend 'While end rsNew.Close rsOld.Close Set rsNew = Nothing Set rsOld = Nothing
I get an run-time error 3079: The specified field ID_BlueTag could refer to more than one table listed in the FROM clause of you SQL statement.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access TechHelp.