Duplicate from current record in form

  • Thread starter Thread starter STiruchi
  • Start date Start date
S

STiruchi

Am using a command button (image) and when I click, get the following
message "The expression you entered requires the control to be in the
active window". This previously worked ok and not sure what happened
inbetween or how to rectify.

Thanks in advance for any help.

ST
 
Please see code below
__________________________________

Private Sub frm_Activity_DuplicateRecord_Click()
On Error GoTo Err_frm_Activity_DuplicateRecord_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste
Append

Exit_frm_Activity_DuplicateRecord_Click:
Exit Sub

Err_frm_Activity_DuplicateRecord_Click:
MsgBox Err.Description
Resume Exit_frm_Activity_DuplicateRecord_Click

End Sub

_____________________________________
 
Did you enter the code below? Or did Access do it from a Wizard? That code
has been deprecated and it is just a pain in the butt to try to figure out
what it does. So, I need to ask - what is each line supposed to do? I
haven't used DoMenuItem code in years because the way to do it now is to use
DoCmd.RunCommand acCmdxxxx (where xxxx is the command - in words - so you
actually know what it does).

--
Bob Larson

Free Tutorials and Samples at http://www.btabdevelopment.com

__________________________________
 
Sorry, but I am not that conversant with vba coding and so use the
wizard to create the database. Basically I have a form with about 5
fields and all I was trying to do was create a button with a command
to duplicate the current record so that the originator can edit only a
couple of fields.

It is only a single form (although another command button within the
form opens another form).

I guess to provide a solution for me is a hard job.

Thanks for the advise so far.

ST
 
Back
Top