Results 1 to 4 of 4
  1. #1
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48

    Duplicating record in form and subforms

    Hello!
    So I have a form with subforms. The main form has it's own table, and each subform has it's own table. The main table has a 1 to many relationship with each subform table, so each record in the main table can show multiple records in each subform. What is the easiest way to automate (like clicking a button) so that a new record from the main table is duplicated, along with all the matching records of each sub table? The primary key in the main table is not auto number... I enter the value I want in case that makes a difference. The sub tables do not have a primary key, just the "many" field that is related to the main table. So my end result will be if I'm looking at a record in the main form, I click a button, and that entire record of the main form and subforms are duplicated exactly but with a different ID that I will enter.


    Please keep in mind that I'm still learning so might not know any advanced explanations very well.

    Thank you!

    Albert

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    2 append queries:
    Q1 copies the master table to the target using the master ID
    Q2 copies the sub table to the target using the master ID

  3. #3
    achammar is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2019
    Posts
    48
    Thank you ranman256!

    That's the route I will start with then!

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    See if this tip by Allen Browne helps you.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Duplicating part of a record from a form
    By swenger in forum Programming
    Replies: 15
    Last Post: 07-12-2016, 08:05 AM
  2. Fields duplicating in subforms of a form
    By Cornerdjh in forum Forms
    Replies: 3
    Last Post: 04-04-2016, 12:46 PM
  3. Replies: 11
    Last Post: 05-13-2015, 11:10 PM
  4. Replies: 19
    Last Post: 05-13-2013, 01:26 AM
  5. Replies: 4
    Last Post: 02-13-2013, 10:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums