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

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?
 
L

Lynn Trapp

Why are you wanting to store redundant data? One of the reasons for having a
relational database is to avoid redundant data.
 
S

SF

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?
 
L

Lynn Trapp

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
 
S

SF

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
 

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