acPasteAppend Adds Record Instead of Update Record

D

Dave

Is there a way to use the acPasteAppend to update a record instead of adding
a new one? On my form I have a "Copy" button and a "Paste" button. This is
the code:

On the copy button (Command2) this code in the Click Event:

Private Sub Command2_Click()
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
End Sub

On the paste button (Command3) this code in the Click Event:

Private Sub Command3_Click()
DoCmd.RunCommand acCmdPasteAppend
End Sub
 
D

Dirk Goldgar

Dave said:
Is there a way to use the acPasteAppend to update a record instead of
adding
a new one? On my form I have a "Copy" button and a "Paste" button. This is
the code:

On the copy button (Command2) this code in the Click Event:

Private Sub Command2_Click()
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
End Sub

On the paste button (Command3) this code in the Click Event:

Private Sub Command3_Click()
DoCmd.RunCommand acCmdPasteAppend
End Sub


acCmdPasteAppend won't work, because it is specifically to *append*. Try
this instead:

Private Sub Command3_Click()
RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
End Sub

But totally copying a record is an unusual thing to be doing. Are you sure
your database is normalized properly?
 
D

Dave

Thank you, that worked. I tried the acCmdPaste before, but I see that I
needed to select the record first. My DB is normalized; it is for a transport
log with some of the records containing the same date, time, and miles.
 

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