Best way to duplicate a record

FISHiEE

Fish obsessive
Local time
Today, 20:39
Joined
Nov 12, 2004
Messages
86
Hi,

I have a table for which I need the user to be able to make an exact copy (every field except primary key) of a various "template" records which they then use as a basis for a new record in the table.

The existing database does this using the following:

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, , acMenuVer70 'Paste Append

after this code is run a macro then changes the primary key field value

This has a few problems already in that for some weird reason a couple of the fields don't get copied. I can get around that though.

My problem is now that I am adding some more features to the system and need this duplication to be completed without copying, pasting and duplicating in the form. ie I want the whole process to be completed in code before the button which runs this code loses the focus.

If anyone can help I would be most grateful!!!!

Thanks in advance

John
 
You could run an append query using the primary key as your criteria, this will add a new record to the underlying table for you but you will need to create the new primary key at the same time though. When you need this new record you will need to do a requry to get the data.

peter
 

Users who are viewing this thread

Back
Top Bottom