Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Duplicate Record in Access 2007

    Hi,

    It's nice to be a part of this group. I found the following instructions on how to duplicate record and create a unique key. This instruction is for Access 2000. I tried it in Access 2007, with no luck.

    DoCmd.RunCommand acCmdSelectRecord
    DoCmd.RunCommand acCmdCopy
    DoCmd.RunCommand acCmdPasteAppend


    Thanks.

  2. #2
    Star Lounger
    Join Date
    Dec 2009
    Location
    Findlay, Ohio
    Posts
    57
    Thanks
    4
    Thanked 6 Times in 6 Posts
    Any error message(s)?

    I use the above in access 2007 with no issues.
    I also put a
    DoCmd.RunCommand acCmdSaveRecord
    to save any changes before I do the select.
    Last edited by orangehat; 2013-08-22 at 14:10.

  3. #3
    WS Lounge VIP access-mdb's Avatar
    Join Date
    Dec 2009
    Location
    Oxfordshire, UK
    Posts
    1,722
    Thanks
    146
    Thanked 156 Times in 149 Posts
    I'm slightly confused here - if the key is primary with autonumber then this should work. But have you got any other sort of key, e.g. two fields combined? If so then this won't work as the key values won't be changed - you would have to do it manually.

    I have a database of my photographs. The main table's key is the file name (of the digital photo) plus the date shot. As I have a number of duplicate file names, adding the date shot keeps them unique so the combined fields are the primary key. The above wouldn't work without changing one or bot of those fields.

    Or have I got hold of the wrong end of the stick? Note I'm talking 2003 here but I assume that newer versions would be the same.

  4. #4
    New Lounger
    Join Date
    Aug 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It tells me “The changes you requested to the table were not successful because they would create duplicate values in the index, primary key or relationship…” once I try to save, which I've figured out that I first need to change the name field before trying to save. Thanks.

    When I use the Access 2007 Button function, the macro language is different. When I tried incorporating the above, got the error message that the "slectrecord" isn't available. However, I've gotten it to work.

    On another note, how would I tell it which fields to duplicate? For example, I have name, DOB, SSN, which are unique, but I have "case information and details" that will remain the same if a case involved more than one person.

    Thanks a bunch!

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
  •