J
J.J.
I have a form which has a subform in which a user enters a lot of data.
Occasioanlly the same event occurs so I would like to create a button either
on the form or subform that will copy over the data from a previous record
where the current customerID matches the previous entry. I found what I
thought was an elegant piece of code but I can't get it to work. It also
needs to reference the customer ID. An error message reports that there is
no current record even though the customerID displays in both the form and
subform.
With Me.RecordsetClone
.Bookmark = Me.Bookmark
.MovePrevious
Debug.Print IntakeDataID
For Each ctl In Me.Controls
If ctl.Tag = "RepeatPrevious" Then
ctl.Value = .Fields(ctl.ControlSource)
End If
Next
End With
One further question. By tagging the subform will all controls be copied or
does each one have to be tagged seperately?
Occasioanlly the same event occurs so I would like to create a button either
on the form or subform that will copy over the data from a previous record
where the current customerID matches the previous entry. I found what I
thought was an elegant piece of code but I can't get it to work. It also
needs to reference the customer ID. An error message reports that there is
no current record even though the customerID displays in both the form and
subform.
With Me.RecordsetClone
.Bookmark = Me.Bookmark
.MovePrevious
Debug.Print IntakeDataID
For Each ctl In Me.Controls
If ctl.Tag = "RepeatPrevious" Then
ctl.Value = .Fields(ctl.ControlSource)
End If
Next
End With
One further question. By tagging the subform will all controls be copied or
does each one have to be tagged seperately?