Results 1 to 4 of 4
  1. #1
    HansBades is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    85

    Copying records

    I have a form where three of the fields combine in a unique index. For instance, the part field and two related approval code fields (the combo of the three together) need to be unique per work order number. But often may different parts on the work order will have the same approval codes and other fields. It would be helpful if I could just copy the first record in the form to the second and change the part. However, since I have the combo set as unique it won't do it. Any way to work around this and not lose the integrity of keeping the form with the unique records it needs?.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The combo is for what field? You mean field it is bound to is set as unique? Why?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    You might need what I call a staging table - one that mimics the design of the final table (except for the ID field, such as the autonumber ID field). The staging table will allow a copy of the record, where you change whatever value in whichever field that will maintain the uniqueness of the combination of fields. You might need form level validation but that's not clear from your post. You could test for the uniqueness of the combination in the staging table compared to the final table after the staging table record is edited, or you could simply attempt to update/append the new combination to the final table and trap any resulting error if the attempt fails.

    Or maybe you could figure out why whatever you're doing is attempting to save a record with the copied fields. If you copy a record that doesn't pass validation, you need to provide the opportunity to edit that record before you do anything that will attempt a save. Also, there is some ambiguity when you use the term combo in your post, as it could be taken to mean the combination of some fields, or it could refer to a combo box control.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    HansBades is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Dec 2021
    Posts
    85
    Good ideas. Thank you.

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

Similar Threads

  1. Copying records on a subform (Almost there!)
    By Noodle1791 in forum Programming
    Replies: 3
    Last Post: 02-12-2016, 08:57 AM
  2. Copying records from one table to another
    By willster88 in forum Access
    Replies: 2
    Last Post: 03-22-2014, 01:57 PM
  3. Replies: 2
    Last Post: 01-02-2014, 03:05 PM
  4. Copying records
    By Lowell in forum Access
    Replies: 3
    Last Post: 09-07-2012, 12:26 AM
  5. Replies: 6
    Last Post: 03-22-2011, 08:22 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