R
Red Rider
I have created a Access 2002 database that has a main form and a
subform (1 to many). After I run a macro that filters the main form
down to 1 record, with maybe 10 records in the subform, I attempt to
run a separate procedure that tries to create a new record that
duplicates the current subform record. Each time I try this I get an
error saying “Records in that TestDB was unable to paste have been
copied to the “Paste Errors” table.” If I don’t filter the main form
the program runs OK in the subform. I’d like to be able to duplicate
a subform record whether the main form is filtered or not.
Here’s the code:
Private Sub DuplicateRecord_Click()
On Error GoTo Err_DuplicateRecord_Click
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
' old code - caused same error as code above
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste
Append
Exit_DuplicateRecord_Click:
Exit Sub
Err_DuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_DuplicateRecord_Click
End Sub
Any help would be appreciated.
subform (1 to many). After I run a macro that filters the main form
down to 1 record, with maybe 10 records in the subform, I attempt to
run a separate procedure that tries to create a new record that
duplicates the current subform record. Each time I try this I get an
error saying “Records in that TestDB was unable to paste have been
copied to the “Paste Errors” table.” If I don’t filter the main form
the program runs OK in the subform. I’d like to be able to duplicate
a subform record whether the main form is filtered or not.
Here’s the code:
Private Sub DuplicateRecord_Click()
On Error GoTo Err_DuplicateRecord_Click
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
' old code - caused same error as code above
'DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
'DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste
Append
Exit_DuplicateRecord_Click:
Exit Sub
Err_DuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_DuplicateRecord_Click
End Sub
Any help would be appreciated.