How can I duplicate records into a table using a form

  • Thread starter Thread starter Alf
  • Start date Start date
A

Alf

I want to enter the same record several times using a form and storing these
records into a table. How can I duplicate one record for a number of times,
(say 5 times) at once
 
Hello Alf,

Place a button on the form. On tha tag property of each control for the
fields you want to copy, place an identifier such as the word "Copy"
(without the quotes).

In the Click event for the button place this code:


Dim ctl As Control
With Me.RecordsetClone
.AddNew
For Each ctl In Me.Controls
If ctl.Tag = "Copy" Then
.Fields(ctl.Name) = ctl
End If
Next ctl
.Update
.MoveLast
Me.Bookmark = .Bookmark
End With

Each time you click the button, a new record will be created. You will also
be taken to the new record. If you want to stay on the original record,
remove the lines,

.MoveLast
Me.Bookmark = .Bookmark

God Bless,

Mark A. Sam
 
Back
Top