Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why do I get a "Paste Error" when I use a duplicate record button?

Status
Not open for further replies.

gandalf1

Programmer
Sep 13, 2001
14
US
I have a duplicate record button on a form so that users will not have to re-type header information. When you click on the button it generates a Paste Errors Table. Is this because the form has drop-down boxes, or is it something else? Thanks in advance for any suggestions you may have.


Justin
 
You probably have the form bound to a table with a primary key that is not being incremented when you click the "Duplicate Record" button. Thus you're attempting to add a record with the same primary key to the table so Access puts the record in the Paste Errors table instead.

To get around this you can install an AutoNumber primary key on your table or use a numeric key that increments automatically. In the code behind "the Duplicate Record" button you need to advance the record pointer to a new record (See help on advancing to a new record) and if using a straight numeric primary key then use an expression like: Me!PrimaryKeyField = DMax("PrimaryKeyField", "TableName") + 1.

If the information in the header is always the same consider using default values at the table level. They will be pasted onto the form for each new record and can be changed by the user if necessary.

Cheers,


Uncle Jack
 
If UncleJack's advice doesn't help, try repairing and compacting your data file.
 
Thank you for replying!I do have the primary key set to an aoutonumber field, so that dosen't seem to be the problem. I am only getting that error on one computer. On other computers it runs fine. I used to wizard to build the duplicate key, and it does what I want it to, but not on one particular computer.

Thanks Again,
Justin
 
I don't have an answer for that one. Buy a new computer?

Uncle Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top