Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
Copying to child records
Melvin Brewton 
   
3 years ago
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.
Melvin Brewton OP  @Reply  
   
3 years ago

Richard Rost  @Reply  
          
3 years ago
You need to specify the table the fields are coming from in the sql.

...FROM Customer WHERE CustomerT.CustomerID=X

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/6/2026 6:27:20 AM. PLT: 1s