Duplicate Button Not Working

G

Gina Whipp

Hi Gurus...

Below is a sample of my code. What I want to happen is press this button
copy the rcord , paste it to the last record which should show on the
formsand put a '0' in the OrderID field (you have enter the new one). But
what is happening is you are just overtyping the existing record.... You
THINK it's gone to a new record because it does zero out the OrderID but in
fact you have not gone anywhere and you have just changed the OrderID on an
Order that was previously entered.

Also note the form on which this button resides can be pressed from any
record not just the first record. If you do it while it is one the first
record it works fine, it really shouldn't matter which record you are on,
should it?

Can someone tell me why this code won't work???? BIG THANKS!

Private Sub cmdDuplicate_Click()
On Error GoTo Err_cmdDuplicate_Click

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append
Me.txtOrderID = 0
DoCmd.GoToRecord , , acLast

Exit_cmdDuplicate_Click:
Exit Sub

Err_cmdDuplicate_Click:
MsgBox Err.Description
Resume Exit_cmdDuplicate_Click
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top