Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16

    Mass update child table

    I have about 50 members in a parent table who are “Honored Life Members”. My child table consists of all the payments for all of the members by year.



    what I would like to do is a mass record add for the “honored Life Members” in the payment table. The record shows them as paid for the year 2024.

  2. #2
    xps35's Avatar
    xps35 is online now Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    232
    What did you try so far? Why add payments if they don't have to pay?
    Groeten,

    Peter

  3. #3
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    How is the Parent Table linked to the Child Table?
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  4. #4
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    It is in a one to many. One membership record to multiple years of payments

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    One way would be to copy the records manually and paste append them. Assuming you're using an autonumber field, then update the date to your 2024 date WHERE myIdField > whatever your last number was before the append. Copy and paste append can be wonky sometimes so I'd suggest copying the table first so that you have a backup of it.

    Of course, there are more complicated methods such as writing code to
    - copy the recordset and append the new records with the 2024 date using .AddNew, or
    - write a sql statement that loops over a recordset and runs an update sql statement that makes use of the new date
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Thought about creating a table of just those members and then append to the payments. As the payment is linked via member number (auto number) in the parent table. Just hoped there might be a simple query to do so.

  7. #7
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    You might be able to do it with one query, come to think of it. It would be an append query that uses the member table and the payments table, linked on the pk and fk (master/child) fields. The query would use a calculated field to create your date field values. While I know that you can Update 2 tables at the same time, I don't recall ever trying to append to only one when using 2 related tables. That it is possible to update makes me think it should be possible to append.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  8. #8
    Join Date
    Apr 2017
    Posts
    1,679
    Quote Originally Posted by Oregoncoder View Post
    It is in a one to many. One membership record to multiple years of payments
    Do you mean the payments table is like
    tblPayments: PaymentID, MemberID, PaymentYear1, PaymentYear2, ... !?

  9. #9
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Quote Originally Posted by ArviLaanemets View Post
    Do you mean the payments table is like
    tblPayments: PaymentID, MemberID, PaymentYear1, PaymentYear2, ... !?
    It is actually a record for each year. Looking to add a new record for the year 2024.

  10. #10
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Can you upload a screenshot of the relationships window showing all your tables?
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  11. #11
    Join Date
    Apr 2017
    Posts
    1,679
    So the structure of payments table is like
    tblPayments: PaymentID, MemberID, PaymentYear/PaymentDate, Payment

    The query (simplified one) will be something like
    Code:
    INSERT INTO tblPayments (MemberID, PaymentYear, Payment)
    SELECT mem.MemberID, PaymentYearValue, SomeExpression As Payment
    FROM tblMembers mem WHERE mem.SomeField = "Honored Life Members"

  12. #12
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    Without knowing your table and field name or structure would have thought something like this would work for a normalised database

    Code:
    INSERT INTO tblPayments ( memberFK, tranDate, tranAmount )
    SELECT memberPK, #1/1/2024#, 50
    FROM tblMembers
    WHERE tblMembers.LifeMember=True
    edit: Snap

  13. #13
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Click image for larger version. 

Name:	Onetomany.JPG 
Views:	14 
Size:	21.2 KB 
ID:	51200Ignore the name field in the child table, I put there while creating the database to make sure i knew what I was doing.

  14. #14
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Points to note:-

    1. do not use name as a field name as it is a reserved word in Access.
    2. do not use spaces in field names
    3. you do not need the Year field as you already have the Year as part of RenewalDate
    4. Enforce referencial Integrity to avoid adding child records without a Parent
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  15. #15
    Oregoncoder is offline Novice
    Windows 11 Office 365
    Join Date
    Dec 2023
    Posts
    16
    Quote Originally Posted by mike60smart View Post
    Points to note:-

    1. do not use name as a field name as it is a reserved word in Access.
    2. do not use spaces in field names
    3. you do not need the Year field as you already have the Year as part of RenewalDate
    4. Enforce referencial Integrity to avoid adding child records without a Parent
    Tanks for the advice!

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Programming Ideas - mass update
    By Steven19 in forum Programming
    Replies: 2
    Last Post: 05-06-2022, 04:41 AM
  2. Replies: 11
    Last Post: 01-13-2017, 06:58 PM
  3. Replies: 17
    Last Post: 10-27-2014, 04:15 AM
  4. Replies: 2
    Last Post: 10-30-2013, 07:52 AM
  5. Replies: 3
    Last Post: 07-29-2011, 09:30 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