Adding a primary key from a one to many table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 tables in my database the first table contains student IDs which is
the primanry key for the database. The second table contains the student's
activity for a particular semester such as curriculum declared, hours taken,
etc. I download this information from a statewide database save it as an
Excel file and then import it into my database. The first table has a one to
many relationship with the second table.
The problem I am having is that in order to import the information into the
second table I have to first enter all of the new student IDs into the first
table which is a manually intensive task. I was wondering if there was a way
when I import the Excel file that Access would automatically add any new
student IDs to the first table to avoid manually entering them.
 
I have 2 tables in my database the first table contains student IDs which is
the primanry key for the database.

Databases do NOT HAVE primary keys. Tables have primary keys - and
they'll (almost always, one-to-one relationships being the only
exception) will have DIFFERENT primary keys.
The second table contains the student's
activity for a particular semester such as curriculum declared, hours taken,
etc. I download this information from a statewide database save it as an
Excel file and then import it into my database. The first table has a one to
many relationship with the second table.
The problem I am having is that in order to import the information into the
second table I have to first enter all of the new student IDs into the first
table which is a manually intensive task. I was wondering if there was a way
when I import the Excel file that Access would automatically add any new
student IDs to the first table to avoid manually entering them.

Can you count on the student ID's in the Excel spreadsheet matching
your student ID's? If so, you can run two queries: an Append query to
add new records, and an Update query to update existing records.
Without knowing more about the structure and contents of the two
tables it's a bit hard to give precise instructions.

John W. Vinson[MVP]
 
Back
Top