To add a new record by copying from another record then change the primary key

  • Thread starter Thread starter SF
  • Start date Start date
S

SF

I use the form to add new records, but I want to copy most of the fields
from another record and just change the primary key to create this new
record.

I'm able to bring up the record that I want to copy from. What shall I do
after I change the primary key field?
 
Why are you wanting to store redundant data? One of the reasons for having a
relational database is to avoid redundant data.
 
Hi, Lynn,

The primary key is a combination of two fields, for instance Company Name
and Company Division. When adding records with the same Company Name
(CompanyA, DivisionA) but different Division (CompanyA, DivisionB), most of
the fields in these two records are the same and I want to save user some
time to enter the same data.

How to do it?
 
You should consider storing the information that is common to a Company,
regardless of Division, in a different table, then using a query to pull it
all together when you need it.

tblCompany
CompanyName (PrimaryKey)
---Other fields related specifically to a company

tblCompanyDivisions (the two fields are a composite primary key)
Division
CompanyName
 
Hi, Lynn,

Thank you for your advice.

I have no problem to fill all other fields, but after I fill the new
Division which is part of the primary key, how do I add this record to the
table?

If I use command "Save", it'll be treated like modifing a record with
different Division. What command or action shall I use to add this new
record?

SF
 
Back
Top