Results 1 to 5 of 5

Thread: Inporting data

  1. #1
    Join Date
    Sep 2003
    Location
    London
    Posts
    17

    Unanswered: Inporting data

    How do I inport data from a csv, into two tables,making a colom in table two = the auto number in table 1 for linking resons?
    __________________

    HEY HEY MY MY

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Presumably you are able to split the data using import specs into the two different tables.

    If you are going to retain the referential integrity between the two and continually destroy the data in the tables (on importing new):

    Once you have imported table1, import the data for table2 into a temp table with the identifier within the data itself to map back to table1. Link the data between table1 and the temp and p/u the autonumber field to create table2.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Sep 2003
    Location
    London
    Posts
    17
    Hi Sorry,

    I dont know how to get the data into two tables at the same time. I only know how to inmport to one table at a time.

    I still dont understand what you mean by mapping to the table. I can do this fine in a form. But when importing the data it seams hard.

    So in more detail.

    I need to be able to get data from A CSV file into two tables, Table1 has an autonumber that will count as the data goes in. I need the Clinet_ID in table 2 to match that in table 1.

    Please some one help.

    Thanks

    Davey
    __________________

    HEY HEY MY MY

  4. #4
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    What I mean by map is the following:

    Let's say your csv file contains three fields: Credit Card number (which is unique), Balance, and Credit Limit, and you want table1 to hold the credit card number and balance (and has an autonum id for your Client ID) and table2 hold the Client ID and the Credit Limit.

    What I am proposing is you read into table1 the credit card number and the balance, into a temp table you read in credit card number and the credit limit. You map from the temp table into table1 using the credit card number, pick up the autonumber, use it and the Credit Limit to put data into table2.

    I realize that this doesn't read into the tables at the same time, but you don't really need to, you just need your referential integrity between the two tables. Besides, I'm pretty sure you can't update two tables at the exact same time as you can only use one update method at a time. In your particular case, you are waiting for an update to happen in table1 so you can retrieve the committed autonumber.

    HTH.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  5. #5
    Join Date
    Sep 2003
    Location
    London
    Posts
    17
    Thank you that was of some help. My only problem being was that I did not have a linking feild between the two. What I ended up doing was adding a new feild to table one, that could link them. Then I did an update quireie where the two link feilds where =.

    Thanks again.

    D
    __________________

    HEY HEY MY MY

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •