Copy record giving three problems


Doug Sanders

I have a form with a button to copy the record (Access '97)

It gives me three problems:

1- It tells me that "Some of the field names for the data you tried to paste
don't match field names on the form"
It doesn't tell me which names they are and I don't see any differences.
If I click 'Yes' to 'Paste data that names match' everything seems to be

2- On exiting the form it gives me a "You copied a large amount of data onto
the clipboard." message that I always to discard. Can this be done

3- On inspecting the table where the record was copied, everything looks
fine except there is a blank record created too. Where is it coming from?'

This is my code:

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

Any help would be appreciated

Doug Sanders

Allen Browne

The copy'n'paste works for the simplest forms, but it runs into problems
where you have other issues like calculated controls and other dependencies.

A fairly simple alternative is to add the new record to the RecordsetClone
of the form. This allows you to specify field-by-field which ones you want
to copy, and to do other things like setting a date field to today instead
of just copying the date from the record you copied.

There's an example of the code here:
Duplicate the record in form and subform
You can just ignore the part relating to the subform.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question