Results 1 to 8 of 8
  1. #1
    Fstrategic is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    4

    Importing into Table with Lookup Fields


    I am trying to import data from an Excel file into a table that has a numb of lookup fields that are linked to other tables. The incoming data that corresponds to the lookup fields has the text value of the fields (e.g., company name , user name) and not the ID of the record that is stored in the target table. As a result the import process fails since Access is looking for the numeric value that points to the related record and not the text that is looked up.

    Anyone has any ideas as to how to make this work?

  2. #2
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by Fstrategic View Post
    I am trying to import data from an Excel file into a table that has a numb of lookup fields that are linked to other tables. The incoming data that corresponds to the lookup fields has the text value of the fields (e.g., company name , user name) and not the ID of the record that is stored in the target table. As a result the import process fails since Access is looking for the numeric value that points to the related record and not the text that is looked up.

    Anyone has any ideas as to how to make this work?

    The best idea is Not to use "lookup fields in tables".

    See http://access.mvps.org/access/lookupfields.htm

    To import the data from Excel, you would have to write a lot of custom code to import the Excel file. Good luck...

  3. #3
    Fstrategic is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    4
    That is not a practical solution at this point. It is too late to change the whole structure of the database.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    As Steve said: "you would have to write a lot of custom code to import the Excel file". Import from Excel to a new temporary table and then do the Lookup's for the values you need and add them to your temp table and then when you have everything right, append just the fields you need to the original table. As Steve said: "Good Luck".

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    I agree with ssanfu and there are several posts recommending the same.

    But I must ask, How can it be too late for proper/practical design?

    Did you do any testing of the import approach during development? Did you have some positive tests? Some test feedback before moving forward?

    You can certainly have Lookup tables as separate tables -- the traditional approach to lookups. Is that not an option?

  6. #6
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101

    Importing into Table with Lookup Fields

    Hi Fstrategic,

    I am chiming in late on this, but I agree with the others that replied, lookup tables are not recommended, just use separte tables to hold your information to feed your combo fields.

    Now, back to your original question, please review the attached database. I think it addresses the same situation you are trying to solve, correct me if I am wrong.

    This is my weather DB, I import a txt file once a month by using queries to add data to the tables in the correct order. As you can see I have data from 1997 to current year and this was all done just using the queires to bring the data in the correct order. Open the DB and open the macro in desgin view and review the steps I created, maybe this will work for you??

    Thanks

  7. #7
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Quote Originally Posted by bigroo View Post

    I am chiming in late on this, but I agree with the others that replied, lookup tables are not recommended, just use separte tables to hold your information to feed your combo fields.
    I think (hope) you meant Lookup FIELDS.

    This is why everyone is saying not to use lookup fields.:
    http://access.mvps.org/access/lookupfields.htm

    Lookup TABLES are good!

  8. #8
    bigroo's Avatar
    bigroo is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jan 2012
    Location
    Austin, Texas
    Posts
    101

    Importing into Table with Lookup Fields

    Hi ssanfu,

    I think (hope) you meant Lookup FIELDS.

    This is why everyone is saying not to use lookup fields.:
    http://access.mvps.org/access/lookupfields.htm

    Lookup TABLES are good!
    Oops, yes lookup fields are not good, correct, thats what I meant to say!!
    Sorry for the confusion!!
    Thanks Ssanfu for the correction!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple fields to the same Lookup Table
    By igooba in forum Database Design
    Replies: 9
    Last Post: 01-03-2012, 04:14 PM
  2. Lookup table combining 2 fields
    By jhoff in forum Access
    Replies: 1
    Last Post: 07-27-2011, 09:31 AM
  3. Max out after importing only 188 fields
    By weston in forum Import/Export Data
    Replies: 2
    Last Post: 03-06-2011, 12:07 AM
  4. XML file not importing all fields
    By ButlerEagle in forum Access
    Replies: 0
    Last Post: 05-17-2010, 10:39 AM
  5. Lookup Fields
    By mikel in forum Access
    Replies: 3
    Last Post: 03-03-2010, 07:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums