Duplicating a Subform Record

  • Thread starter Thread starter Eric
  • Start date Start date
Eric said:
Is there a way to duplicate a record on the subform?

Sure. Would you be doing this from code on the subform itself, or on
the parent form? From the subform itself, you could duplicate the
current record using code like this:

RunCommand acCmdSelectRecord
RunCommand acCmdCopy
RunCommand acCmdPasteAppend

From the main form, you have to set the focus to the subform first, like
this:

Me.SubformControlName.SetFocus
RunCommand acCmdSelectRecord
RunCommand acCmdCopy
RunCommand acCmdPasteAppend

In the above, "SubformControlName" must be replaced with the name of the
subform control (on the main form) that is displaying the subform. This
may or may not be the same as the name of the form object it is
displaying.
 
How do you want to duplicate the data? Select the row and copy select a new
row and paste... in a field press Ctrl+' (apostrophe) and it will fill in
the data from the previous record... or write VBA to copy at the press of a
button...

HTH.

Tom.
 
Back
Top