Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: acPasteAppend Adds Record Instead of Update Record

Geek News

acPasteAppend Adds Record Instead of Update Record
Dave 12/12/2008 5:45:01 PM
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

Re: acPasteAppend Adds Record Instead of Update Record
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 12/12/2008 9:04:42 PM
"Dave" <Dave[ at ]discussions.microsoft.com> wrote in message
news:D163E0AA-BD54-46A1-8C35-0C577D8B5310[ at ]microsoft.com...
[Quoted Text]
> 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?

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

Re: acPasteAppend Adds Record Instead of Update Record
Dave 12/12/2008 9:36:34 PM
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.




"Dirk Goldgar" wrote:

[Quoted Text]
> "Dave" <Dave[ at ]discussions.microsoft.com> wrote in message
> news:D163E0AA-BD54-46A1-8C35-0C577D8B5310[ at ]microsoft.com...
> > 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?
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net