Access: Duplicate a record in Access 2003/XP/2000/97
Question: I've created a form in Access 2003/XP/2000/97 and I want to have a button on the form that duplicates the current record. What VBA code do I use to duplicate the current record in a form?
Answer: You could create a button on the form and attach the following code to the On_Click event:
Private Sub Command1_Click()
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70End Sub
In this example, we've created a button called Command1. We've placed the above code on the button's click event.