Copying the previous record

  • Thread starter Thread starter Keith S
  • Start date Start date
K

Keith S

I have a form that I have added the duplicate record on the add command
button. However, there are four fields that I do not want it to copy.
Whenever I click the button I want the previous record to copy and leave 2
fields null, one field to get the current user, and one field to put today's
date in. Is there a way to do this?

Thanks for the help.
 
Keith said:
I have a form that I have added the duplicate record on the add command
button. However, there are four fields that I do not want it to copy.
Whenever I click the button I want the previous record to copy and leave 2
fields null, one field to get the current user, and one field to put today's
date in. Is there a way to do this?


In other words, you don't want to copy a record. You want
to create a new record using some data from an existing
record.

I think the easiest way to do that is to just copy the
fields from the current record to a new record using code
like:

With Me.RecordsetClone
.AddNew
!thisfield = Me.thisfield
!thatfield = Me.thatfield
. . .
!datefield = Date
!userfield = ???
.Update
Me.Bookmark = .LastModified
End With
 
I have a form that I have added the duplicate record on the add command
button. However, there are four fields that I do not want it to copy.
Whenever I click the button I want the previous record to copy and leave 2
fields null, one field to get the current user, and one field to put today's
date in. Is there a way to do this?

Thanks for the help.

How about an append query, leaving out fields you don't want to copy?
It would take no time at all to write one, and then it could be called
from the form.

Hope this helps,
James
 
Back
Top