Create a duplicate record.

J

Joe C

How do I create a new record in a query with related tables with all the data
from the selected record. Naturally I need a new entry in the key field.

Thanks
Joe
 
J

John Vinson

How do I create a new record in a query with related tables with all the data
from the selected record. Naturally I need a new entry in the key field.

Thanks
Joe

I'm not sure I understand the question. Are you trying to store data
redundantly in the related tables? If so, DON'T!

Please explain the nature of your tables, and their relationships; and
what you're trying to accomplish with an example.

John W. Vinson[MVP]
 
J

Joe C

OK,
I have have orders table and an order details table. For reporting purposes
I have a query to link them together. I want to create a new record that
basically duplicates the selected record. From there I want to adjust fields
like quantity. In essance, I want to cut down on a large amount of data entry
by copying 90% of
the data and adjusting the remaining 10%.

I will be copying the record from the query.

JC
 
J

John Vinson

OK,
I have have orders table and an order details table. For reporting purposes
I have a query to link them together. I want to create a new record that
basically duplicates the selected record. From there I want to adjust fields
like quantity. In essance, I want to cut down on a large amount of data entry
by copying 90% of
the data and adjusting the remaining 10%.

I will be copying the record from the query.

Probably you'll want to run two Append queries, first for the Orders
table and then the OrderDetails table. You can run the two queries
from a Macro or (better) from VBA code. It's not clear how you will be
selecting which record or records to duplicate though!

Another approach is to use VBA code in a Form, if you want to navigate
to a selected arbitrary record and duplicate it. You could open a
Recordset based on the orders table, and add a new record, with code
like

Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.AddNew
rs!ThisField = Me!txtThis
rs!ThatField = Me!txtThat
<etc for all the fields that you want dup'd>
rs.Update

and then run an Append query to append the detail records.

John W. Vinson[MVP]
 

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