Problems with Copy and Paste Append

gadjet

Registered User.
Local time
Today, 00:03
Joined
Jan 21, 2008
Messages
45
Hi,
I trying to duplicate some records displayed in a form after being filtered and I'm doing this using VBA:

' Change form to allow additional records
Me.AllowAdditions = True

'Select all record in filtered view and paste append to table/form
RunCommand acCmdSelectAllRecords
RunCommand acCmdCopy
RunCommand acCmdPasteAppend
'Return form to not allow additions
Me.AllowAdditions = False

And sometimes but not always I get the following error when I use a button to open a form to display the record details using the ID as the criteria.
--------------------------------------------
Run-time error 2427:
You entered an expression that has no value.
--------------------------------------------

The form shows the new paste appended records including their new auto IDs.

Anyone know what I'm doing wrong, be gentle I'm only an access amatuer....
 
I'm not an expert but the VBA I've seen has had the DoCmd in front. If it works without it I'm not shure why it would make a difference but it may.

Code:
DoCmd.RunCommand acCmdSelectAllRecords
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend
 

Users who are viewing this thread

Back
Top Bottom