How to easily duplicate a record ?

  • Thread starter Thread starter Adam
  • Start date Start date
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
 
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
 
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
 
Back
Top