Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Import Excel data to multiple Access tables?

16 views
Skip to first unread message

emanning

unread,
Dec 9, 2009, 1:41:24 PM12/9/09
to
Using A2007. I've got an excel spreadsheet that needs to be appended
to 2 tables in an accdb. The 2 tables have a one-to-many relationship
with each other. The primary key is an autonumber field. I know I
can just append the appropriate spreadsheet columns to the primary
table and a primary key will be automatically generated. But what I
don't understand is how to take that primary key and put it in the
second table as a foreign key, along with the columns that belong in
the second table.

Is there a way to do this with a query?

Thanks for any help or advice.

Rich P

unread,
Dec 9, 2009, 4:27:03 PM12/9/09
to
In the detail data -- either the import table or (easier) to Detail Data
Excel sheet -- you need to add a column which will contain the
respective Primary Key values. This column will be your foreign key.
Then you will be able to copy the data to the permanent detail data
table.

If you have 500 master records in Excel and 5000 detail records you need
to match the records up first before importing them. Like master record
1 has 5 detail records, record2 has 13 detail records, ...

If you dont already have any key fields in Excel to match master and
detail records, and you have thousands of records to deal with, then
this will be tedious as you have to do it manually.

Rich

*** Sent via Developersdex http://www.developersdex.com ***

0 new messages