How to easily duplicate a record ?

A

Adam

Hi all,

does anyone have some code whereby I can click on a button and have it
create a new record with some of the fields filled in from the master
record, It would be handy if it popped up and asked for the new "Application
Number" (the primary key).

Any ideas ?

cheers,

Adam
 
J

Jim/Chris

I assume you are viewing the record to be duplicated. one
way is to add a button that runs an append query. the
fields for the query [Forms]![form name]!
[fieldname]...each of these would be appended to the
coresponding field in your table. For the new primary key
the name would be [Enter new primary key]. This causes a
popup box for the new primary key.

Jim
 
M

Marshall Barton

Adam said:
does anyone have some code whereby I can click on a button and have it
create a new record with some of the fields filled in from the master
record, It would be handy if it popped up and asked for the new "Application
Number" (the primary key).

Here's the kind of code I use to duplicate most of the
foem's current record:

With Me.RecordsetClone
.AddNew
!fieldA = Me.txtFieldA
!fieldB = Me.txtFieldB
. . .
lngNewNum = InputBox( . . .
![Application Number] = lngNewNum
.Update
me.Bookmark = .LastModified
End With
 

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