Link to home
Start Free TrialLog in
Avatar of Mike Rudolph
Mike RudolphFlag for United States of America

asked on

Access Import data into several tables at once

Dear Experts,

I have CSV file that looks something like this:

Name                    Company             Product Type
Joe                         Nike                       Shoes
Robert                  Columbia             Outer Wear
Tom                       Nike                       Outer Wear
And I have an Access database that has these tables and columns:

Sales Rep Table
Sales_Rep_ID    SR_Name

Company Table
Company_ID      Co_Name

Product Table
Product_ID         Product_Name


Each ID field is the primary key and is an autonumber field. I want to import my data from the report to look like this (with whatever ID numbers come up from the autonumber field; these numbers are just examples):

Sales Rep Table
Sales_Rep_ID    SR_Name            SR_Company     SR_Product
1           Joe                           1                            1
2           Robert                      2                            2
3           Tom                           1                           2

Company Table
Company_ID      Co_Name
1      Nike
2      Columbia

Product Table
Product_ID         Product_Name
1      Shoes
2      Outer Wear

How can this be done if the original report is long enough to want it to be automated somehow? Editing 1000+ rows by hand shouldn’t be the solution.

The first table should contain the correct foreign keys to for the child tables.  Is there a way I can set up do command that would import this flat file and populate all three tables first Company and Project tables and thent he Sales rep table to ensure the right foreign key is used?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of dqmq
dqmq
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Andrew_Webster
Andrew_Webster
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Rudolph

ASKER

Thanks all this helped!