Yes No Prompt on duplicating record

Lochwood

Registered User.
Local time
Today, 07:34
Joined
Jun 7, 2017
Messages
130
Ok, I have a user that wants to duplicate some records in access 2010. I know this it is a simple task to create a button to duplicate only this creates the record directly on clicking the button. I would like the user to have a prompt that when the user clicks duplicate record, they get a prompt "Are you sure you would like to duplicate this record" Yes No. yes creates the record and no ends the code. the current code for duplicating the record from a button is a follows.


Private Sub Command64_Click()
On Error GoTo Err_Command64_Click

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
Exit_Command64_Click:
Exit Sub
Err_Command64_Click:
MsgBox Err.Description
Resume Exit_Command64_Click

End Sub
 
Simply add a messagebox with a prompt before your existing code;
Code:
If MsgBox("Are you sure you want to duplicate this record?", vbYesNo, "Confirm Duplicate!") = vbNo Then Exit Sub
 

Users who are viewing this thread

Back
Top Bottom