A
Alex
I am writing code to put in a button OnClick event that will duplicate a
record. A user navigates to a record in the NewPartInputfrm that he wants to
duplicate then clicks a Duplicate button, which opens the
CreateDuplicateRecord form. The user completes The Model and New Part NHL
fields in the CreateDuplicateRecord form then clicks the AddRecord button,
which opens the NewPartInputfrm to the record he had navigated to. That
record is copied and pasted with the Model and New Part NHL fields populating
from choices in the CreateDuplicateRecord form. This works perfectly.
However, I have a multiple 3 field primary key in the NewPartInputfrm
(Model, New Part NHL and Part). All three fields are completed, but when I
try and click anywhere on the newly created record, the msg, "primary key
cannot contain a null value" appears. I've tried to requery, refresh and
me.dirty = false the newly created form and get the same message with
everything I try. Any ideas how I can fix this? Thanks you.
DoCmd.OpenForm "NewPartInputfrm", , , , acFormEdit
With DoCmd
.RunCommand acCmdSelectRecord
.RunCommand acCmdCopy
.RunCommand acCmdPasteAppend
End With
Forms![newpartinputfrm]![model] =
Forms![CreateDuplicateRecord].[ChooseModel]
Forms![newpartinputfrm]![New Part NHL] =
Forms![CreateDuplicateRecord].[NewNHL]
End Sub
record. A user navigates to a record in the NewPartInputfrm that he wants to
duplicate then clicks a Duplicate button, which opens the
CreateDuplicateRecord form. The user completes The Model and New Part NHL
fields in the CreateDuplicateRecord form then clicks the AddRecord button,
which opens the NewPartInputfrm to the record he had navigated to. That
record is copied and pasted with the Model and New Part NHL fields populating
from choices in the CreateDuplicateRecord form. This works perfectly.
However, I have a multiple 3 field primary key in the NewPartInputfrm
(Model, New Part NHL and Part). All three fields are completed, but when I
try and click anywhere on the newly created record, the msg, "primary key
cannot contain a null value" appears. I've tried to requery, refresh and
me.dirty = false the newly created form and get the same message with
everything I try. Any ideas how I can fix this? Thanks you.
DoCmd.OpenForm "NewPartInputfrm", , , , acFormEdit
With DoCmd
.RunCommand acCmdSelectRecord
.RunCommand acCmdCopy
.RunCommand acCmdPasteAppend
End With
Forms![newpartinputfrm]![model] =
Forms![CreateDuplicateRecord].[ChooseModel]
Forms![newpartinputfrm]![New Part NHL] =
Forms![CreateDuplicateRecord].[NewNHL]
End Sub