Full Version: Duplicating Records On Form And Subform
UtterAccess Forums > Microsoft® Access > Access Forms
Kruzer
I would like to duplicate records via a command button on a form that copies the current form data and subform data to a new record. While I have successfully done this before, I am receiving a message that says "Run-time error '3022': The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship..."

The command button is on the form Invoice Subform. Could someone take a look and let me know what I am not seeing or doing correctly please?

Click to view attachment
GroverParkGeorge
I think you really don't want to duplicate records, but to copy partially duplicated records, correct? The reason for pointing out that distinction is, of course, that doing so depends on understanding which parts of the record can be copied and which parts can't.

The error message is most likely accurate, "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship"

If your copy procedure includes a Primary Key field, it will, and should, fail. So, examine the copy process and identify any place where you are trying to duplicate either a Primary Key or fields in an index that is defined to be unique ("Indexed, No Duplicates").
Kruzer
You are correct in that I want to copy data from one record into a new record.

I now have it working. I was including an incorrect field in the copy data. Thanks for your feedback George.
GroverParkGeorge
Congratulations on solving the problem.

Continued success with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.