Error on 2nd Combo when Adding a Dup Rec

net

Registered User.
Local time
Today, 03:27
Joined
Mar 12, 2006
Messages
50
Hi,

I need help on this error message I am getting when I click on my Duplicate Record button (created through the wizard).

I have two combo boxes on the main form that populates data when the user makes a selection from the combo box. First combo box populates project data and the second combo box populates equipment data. The form is working well with the two combo boxes populating the data into the main table.

Now I would like to add a duplicate record button to copy a record and paste the data as a new record. So, I added a duplicate record button using the wizard and I am receiving the following AfterUpdate error.

Run-time error ‘3020’:
Update or CancelUpdate without AddNew or Edit.


This is the code I am using to copy and paste a duplicate record:

Private Sub InputForm_DupRec_Button_Click()
On Error GoTo Err_InputForm_DupRec_Click

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdSaveRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend

Exit_InputForm_DupRec_Click:
Exit Sub

Err_InputForm_DupRec_Click:
MsgBox Err.Description
Resume Exit_InputForm_DupRec_Click

It seems to be duplicating the data from the first combo box, but not the second one where it errors out. I have no idea what is going on. Is there a better or easier way to get around this issue?

I would really appreciate any help offered.
 
just run a query...it pulls the record you are on and add it again.

docmd.openquery "qaAddRecord"
 

Users who are viewing this thread

Back
Top Bottom