Copying / Creating New version of data

A

alathwell

I have a databse that genrates quotations and consists of a mian form and
several tabbed subforms. The user base needs to be able to copy the
quotation. I currently do this in what I consider not particularly smart way.
In VB I basically run the copy command for the main forms data then using a
querydef recordset to loop through the other related records from the related
tables. In the loop I create a new repord and copy every field into the new
record. It does work but I am not happy with this approach. I would like an
more articlulate way of doing this. What the user wants is to view the copied
version immedioately the copy is completed.

Any suggestions would be appreciated.

Regards

alalthwell
 
A

Allen Browne

See:
Duplicate the record in form and subform
at:
http://allenbrowne.com/ser-57.html

The article suggests duplicating the main record with AddNew on the main
form's RecordsetClone (which gives you the new primary key value), and then
executing an Append query statement to duplicate the related records (which
gives you precise control over which fields are duplicated.) If you have
several related tables (populating several subforms), you will execute
several Append query statements.
 
A

alathwell

Thanks very much. After a bit of playing around the code you suggested works
really well and in much more articulate fashion.

Regards

alathwell
 

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