This is the code behind the button. The primary key is called MainIndex and
when I look at the form in the datasheet view (I even went ahead and
displayed the primary key on the form), they are completely separate. It's
totally driving me nuts! It's not supposed to be rocket science!
Thanks. Just venting and quite frustrated.
Private Sub cdmDuplicate_Click()
On Error GoTo Err_cdmDuplicate_Click
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend
Exit_cdmDuplicate_Click:
Exit Sub
Err_cdmDuplicate_Click:
MsgBox Err.Description
Resume Exit_cdmDuplicate_Click
End Sub
"John Vinson" wrote:
> On Thu, 3 Feb 2005 11:23:03 -0800, "Michelle" <Michelle
> @discussions.microsoft.com> wrote:
>
> >All I am trying to do is to copy a previous record into a new one - more like
> >prefilling a form based on the values of the previous record. I added a
> >command button for that using the wizard and right there is the duplicate
> >record button. it works fine. however, i would need to edit my now new
> >record to reflect some minor changes like the of the record. For some reason
> >I don't know, once I edit the new record, the contents of the old record gets
> >erased!
> >
> >Why is that and how can I stop this?
> >
> >Thanks a million!
>
> Please post the wizard code. That shouldn't be happening! What's the
> Primary Key of the table? Are you assigning a new value for the new
> record?
>
>
> John W. Vinson[MVP]
>
|