copy a record as a new record in vba

lg5050

Registered User.
Local time
Today, 01:12
Joined
Nov 26, 2014
Messages
25
Hi, i am trying to copy a record as new record in vba in access so i make a button for the user so that they can copy a record each time and change a certain field if they wanted. How would i do that.
 
Ok i add the code to the table and it copied it but i get an error message which i will have a image to show what it is. The code that i used was:

Private Sub cmdDuplicate_Click()
On Error GoTo Err_cmdDuplicate_Click


DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste

Exit_cmdDuplicate_Click:
Exit Sub

Err_cmdDuplicate_Click:
MsgBox Err.Description
Resume Exit_cmdDuplicate_Click

End Sub
 

Attachments

  • Error Message for Master Database.png
    Error Message for Master Database.png
    28 KB · Views: 235

Users who are viewing this thread

Back
Top Bottom