G
Guest
Hello,
I have a form with a subform and I would like to create a button that copies
the entire contents of the record (including subform) into a new record. I
have fantistic code for copying the main form, but how could I tweak this
code to include my subform (Partner_WI_Subform)? Thanks so much for your time
and dedication to this discussion group!
Private Sub CopyRecord_Click()
Set rs = RecordsetClone
If Me.Dirty Then Me.Dirty = False 'Save first.
If Me.NewRecord Then
MsgBox "Pick a record to duplicate."
Else
'Select the current record in the clone set.
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
'Move the form to a new record.
RunCommand acCmdRecordsGoToNew
'Copy the old fields into the form.
Me.Company = rs!Company
Me.State = rs!State
Me.[Status I] = rs![Status I]
'etc for your other fields.
End If
Set rs = Nothing
End Sub
I have a form with a subform and I would like to create a button that copies
the entire contents of the record (including subform) into a new record. I
have fantistic code for copying the main form, but how could I tweak this
code to include my subform (Partner_WI_Subform)? Thanks so much for your time
and dedication to this discussion group!
Private Sub CopyRecord_Click()
Set rs = RecordsetClone
If Me.Dirty Then Me.Dirty = False 'Save first.
If Me.NewRecord Then
MsgBox "Pick a record to duplicate."
Else
'Select the current record in the clone set.
Set rs = Me.RecordsetClone
rs.Bookmark = Me.Bookmark
'Move the form to a new record.
RunCommand acCmdRecordsGoToNew
'Copy the old fields into the form.
Me.Company = rs!Company
Me.State = rs!State
Me.[Status I] = rs![Status I]
'etc for your other fields.
End If
Set rs = Nothing
End Sub