Copying a record

  • Thread starter Thread starter BobRoyAce
  • Start date Start date
B

BobRoyAce

I have a form whose Default View is specified to be Continous Forms. In the
detail section I have a row of edit controls, some of which are bound to a
datasource and some of which are not. Additionally, I have a little button
(to the far left) that appears for each record. What I want to do, when the
user clicks on this button, is copy the record on the "line" it's on and
append it to table. I will not be copying all of the fields on the existing
record into the new one...just certain fields.

How would I actually make something like this happen (i.e code)?
 
Create an append query with the fields you want to copy and
use the record ID from the open form for the criteria.
[Forms]![NameOfForm]![record id]
You will need to add the new record ID by inserting a new
field in the query NewRecorId in the form. You will be
prompted for this. If your RecordIDs are autonumber you
can skip this part.

Jim
 
Not to answer your question, but: copying certain fields from one record to
another one, is often a signal of incorrect table design.

Say you have a table T1 containing 5 fields A thru E. Say you often copy
fields A, C & E from an existing record of T1, into a new record. Then you
change fields B & D for the new record.

In that scenario, fields B & D should probably be in a seperate table, T2.
Then, each record (containing common values for fields A, C & E) in table
T1, can link to one or more records (containing fields B & D) in table T2.

This is the concept of "normalization". Read-up more on that topic, if you
have not heard of it.

HTH,
TC
 
I fully understand normalization and, in this case, there is no issue with
respect to that. Besides that, there are cases that can be made for
denormalization in certain instances. That being said, any ideas on the
original question?
 
Back
Top