I am assuming this is because you are going to enter 'similar' data in a new
record, and you want the current data 'copied' over to the new record. May I
recommend a slightly different approach? Instead of 'adding' a new record,
why not set the defaults of the control to the 'current' values, then go to
a new record.
For example, put this code behind the OnClick event of the button you are
setting up for this:
On Error Resume Next
Dim ctrl As Control
For Each ctrl In Me.Controls
ctrl.DefaultValue = """" & ctrl.Value & """"
Next
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
The only drawback to the code above, is that the default values are now set
to that particular records value. So every new record will have those
defaults. So, put another button for a 'blank' new record, and use this
code:
On Error Resume Next
Dim ctrl As Control
For Each ctrl In Me.Controls
ctrl.DefaultValue = ""
Next
DoCmd.GoToRecord acDataForm, Me.Name, acNewRec
Now, if you are already using default values, and want to 'preserve' those,
for a 'blank' record, you can use the same method, just either hardcode the
original back into the normal new record button, or build a collection of
the original values (for the 'carbon copy' process , and drop them back in
for the blank process.
One last note. The advantage of setting the values as defaults, instead of
creating them as a new record, is that if the user backs out, nothing was
written to the database.
Drew