Copying the previous record

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.
 
M

Marshall Barton

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
 
M

Minton M

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top