Hello All.
Our database allows a user to duplicate a record using the following code:
Once the command button is clicked. A duplicate record is clicked and the toolbar at the bottom of the form now shows record 2 of 2, see below.
However if the user clicks anywhere on the form, the record jumps back to the record that has been duplicated. In this case record 1 of 2. The user could just hit the Last Record button on the toolbar, but I was hoping for it to remain on the last record.
Does anybody know how to do this?
I have tried adding the following code at the end of the command button, but this doesn't work.
Thanks All.
Our database allows a user to duplicate a record using the following code:
Code:
Private Sub CommandDuplicate_Click()
On Error GoTo Err_CommandDuplicate_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
[Code No] = "NONE"
Me.CreatedBy = [TempVars]![tvarUser]
Exit_CommandDuplicate_Click:
Exit Sub
Err_CommandDuplicate_Click:
MsgBox Err.Description
Resume Exit_CommandDuplicate_Click
End Sub
Once the command button is clicked. A duplicate record is clicked and the toolbar at the bottom of the form now shows record 2 of 2, see below.
However if the user clicks anywhere on the form, the record jumps back to the record that has been duplicated. In this case record 1 of 2. The user could just hit the Last Record button on the toolbar, but I was hoping for it to remain on the last record.
Does anybody know how to do this?
I have tried adding the following code at the end of the command button, but this doesn't work.
Code:
DoCmd.RunCommand acCmdRecordsGoToLast
Thanks All.