Creating a dupplicate record

Kylor

Registered User.
Local time
Today, 15:43
Joined
Dec 14, 2000
Messages
17
How is it possible to use a form to create a duplicate record (with the exception of the PK)? The example here is that the sales group wants to be able to quickly create a new order by copying a prior order.
 
Does your form look at more than one related table?

In a given order, are there multiple records in a table, one for each item in the order? if so, you are going to have to also copy these records in the appropriate other table.

My clumsy solution to this was to write some code (with assistance from this Forum!) to add a new record to a recordset representing the form's source query, using explicit statements for each field that required population. I know that this means that I would have to chnage the code everytime I add, delete, or change a field, but I was in a hurry and couldn't come up with an elegent solution.

I then created another recordset with all of the records in the related table that used the PK of the original record in the Order table as the FK. Then I looped through this recordset and created new records in the other table using the same clumsy code.

I am not happy with this solution, but I'll share it with you. Does anybody out there know of an elegant way to clone every field in a record (other than PK) in code without knowing ahead of time what fields are going to exist?
 
There's a low tech solution to this, if it's not going to happen very often. It is most assuredly not bulletproof:
Edit>Select Record, Edit>Copy
>* (go to a new record)
Edit> Select Record, Edit>Paste
All the fields will be identical, but the PK will be different. What this will do if you have other fields that cannot be duplicated, I am not quite sure.

HTH,
David R
(there's also the Ctrl-' trick if they want to copy just one field from the previous record entered)
 

Users who are viewing this thread

Back
Top Bottom