Results 1 to 5 of 5
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    best way to update a customer ID number when related records

    My accounting department just notified me that one of the clients has the id number wrong. A number was transposed. When i try to update it , i get the error that it can't be updated because of the related records.



    What is the best way to update this record?

    My plan is:
    1. check all the tables that may have this id field and run an update on all the different tables to get the correct number in the other tables.
    2. break the relationship.
    3. update the customer id field
    4. re create the relationship

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    This id is set a primary key in customers table and is saved as foreign key in related dependent table? Do you have relationship set in relationship builder? Do you have Enforce Referential Integrity checked? Do you have Cascade Update checked? Edit the id in customers table and it will automatically update in the related table.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    The relationship is set, cascade update is not checked. There are too many users in the database to check it now. is it a good idea to use cascade updates? I know it is not a good idea to use cascade deletes.

  4. #4
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    It seemed a better idea to create a new record in the customers table that has the same customer name with the correct id. Then if i miss any of the updates it will still show the proper company name.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Nothing wrong with cascade delete. It's purpose is to prevent orphan records in dependent tables. The real concern is whether deletion of parent records should even be allowed.

    Use cascade update only when needed, as in your scenario. It can be dangerous if the parent or 'lookup' table is improperly used, which is not uncommon with inexperienced developers.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2017, 12:01 AM
  2. Update related records.
    By Homegrownandy in forum Queries
    Replies: 10
    Last Post: 11-30-2016, 08:29 AM
  3. Creating variable number of related records
    By msmithtlh in forum Forms
    Replies: 5
    Last Post: 06-13-2016, 04:28 PM
  4. Replies: 3
    Last Post: 03-22-2014, 04:32 PM
  5. Replies: 6
    Last Post: 12-11-2013, 09:27 PM

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