adding auto number into existing database

G

Guest

I want to stop using a student SS# as the identifier. Instead, I would like
to start using autonumber. I have a database with maybe 300 to 400 records.
I tried making a new field of autonumber and it gave each student their own
autonumber. However, how would I transfer these numbers into other related
tables? For example, the main table contains basic student information. A
related table contains testing results based on a date, with the date and SS#
set as the primary key. The student table only has the SS# as the primary
key. How might I transfer the new autonumber to this related testing table
so I can edventually delete the SS#’s?
 
G

Guest

Hey Jason, you can update the second table using an Update query.

-- Create the new field in the student table and make it the PK. We'll call
it: StudentID
-- Create the corresponding FK field in the test table
-- Create an Update query. In the criteria for the new FK field, enter:
tblStudents.SSN = tblTest.SSN
-- Edit keys as needed
-- Remove the old relationship
-- Create the new relationship
-- Remove old fields

Of course, subsitute your table and field names. Also, always backup your
db before making updates!
 

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