Results 1 to 4 of 4
  1. #1
    Join Date
    May 2011
    Posts
    2

    Smile Unanswered: How to create a copy or duplicate record

    I've got a change tool that I've developed that requires a user to make a duplicate record that can be edited while preserviing the baseline record.

    My Access db utilizes PKeys for each table. I've used the create "Duplicate" macro feature in the past with other tools i.e., creating a cmd button and then using the wizard and its worked okay. However, after running the new command in my current db, the record isn't saved and I get the following errror "The changes requested create duplicate values in the index or primary key, or relationship...." It then suggests one option of changing my PK's which isn't an option due the resultant degradation of relational integrity....

    What I'd like to have happen is for the duplicate record to be created as a new record number and for cboRevisionStatus combo to be updated changing the value from "baseline" to "In-work".

    The form I'm attempting to duplicate the record from is "FrmMain". The form has two embedded subforms that are set to datasheet view: "sfrmTier1DefsandDels" and "sfrmPrimeFocals"

    I'm in a pickel so if anyone has any ideas I'd be most appreciative!

    Thanks in advance!
    Last edited by spacedneedle; 05-22-11 at 22:45.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You can't have duplicate values in the Primary Key column, that would mean a lack of referential (relational) integrity (primary key implies UNIQUE CONSTRAINT). In such a case you need to create a composed index (the Autonumber column + the RevisionStatus column) and use it as the primary key.
    Have a nice day!

  3. #3
    Join Date
    May 2011
    Posts
    2

    How to Create a Duplicate Record

    thanks.....Sinndho! I'm not familiar with a composed index.... Do you by chance have an example or diagram of the structure?
    Thanks again!

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Here's an example. The Table is named Table_1 and the 2 columns used to create a composite index are named Row_ID and Row_Status.
    Attached Thumbnails Attached Thumbnails ScreenShot006.bmp  
    Have a nice day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •