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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PasteAppend won't work

Status
Not open for further replies.

missinglinq

Programmer
Feb 9, 2002
1,914
US
I'm trying to duplicate a record using the code below:

Me.AllowAdditions = True
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend
Me.AllowAdditions = False

I get a message that an error in the PasteAppend action has resulted in the data being inserted into an error table. As you can see, AllowAdditions = True, and at the table level Duplicates Allowed is set to Yes.

Any ideas?

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
have you looked in the error table?

it should have a description of the error, although this doesn't always help and can at times hinder...

--------------------
Procrastinate Now!
 
The error table only holds the data that couldn't be appended, no explanation of the error.

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Any chance you have an Autonumber field in your table?

Randy
 
missinglinq
I tried your code on a small form with an autonumber, and it worked. However, I seem to recall that if you have a field that does not allow duplicates, or you have some special validation rule, you will get this problem.
 
No autonumber. Duplicates are allowed; this was the first thing I thought of. No validation rules. It's a simple address book really. A record consists of a name, address and phone and fax numbers.

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Just as a final thought, what is in the clipboard after the code gets to copy?
 
No required fields. I dumped the clipboard into Word, and it had the fields from the record PLUS the headings from the table! Thought this was kinda strange! Looked like it had actually copied and pasted from the table itself!

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
That's what my clipboard looks like, too. I wonder is there any point in appending the line of data cut from Word?
 
Tried that! Even went to a new record then tried to paste. Get an error message "The text is too long to be edited!"

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Ok, this is really grapsing at straws! Run the code on the form and choose Paste Append on the table that the form is based on. Hopefully, you will get a relevant error message. (I guess you know you can use Run clipbrd?)
 
No joy! I did an advanced search here when this started using the string "duplicating record" and found only what I was already using. I just repeated the search using "PasteAppend" and found 5 or 6 posting with the same problem, none of which were ever resolved!

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
I guess you are back to an update query for the duplicate, then. :-(
 
I finally just bit the bullet and rolled my own! Assigned all fields to variables, went to a new record, then reversed the process!

Thanks to everyone for their help!

The Missinglinq

There's ALWAYS more than one way to skin a cat!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top