Import Excel Data to Access Table - Retain Primary Keys
Results 1 to 3 of 3

Thread: Import Excel Data to Access Table - Retain Primary Keys
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2019
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Import Excel Data to Access Table - Retain Primary Keys

    I am working on an inventory database in Access. I have a build of materials list in Excel. The part numbers have prefixes, bases and suffixes. Some of the part numbers are on the build of materials multiple times. Some of the part numbers change occasionally (suffix only; prefix and base will always stay the same). The changes happen often enough (not only part suffix changes, but parts being added, deleted or moved around) that I want to automate the import process of the parts on this build of materials on a daily basis to make sure I keep up with all changes automatically.

    In Access, I am going to be keeping track of stock levels, invoicing, receiving new quantities, etc. - all kinds of activity which requires these parts to have a static primary key because I need to retain history and accurate stock levels of each part.

    How can I import this data from Excel into Access on a regular basis and have Access:
    1) Append any new parts (add to the end)
    2) Ignore any existing parts that haven't changed at all
    3) Replace or update part number (suffix) on those that have changed suffixes and retain its primary key, and therefore all its history, etc.

    AND I also only want every part on the build of materials in my Access table only ONCE regardless of how many times it appears on the build of materials Excel file - I don't want more than one instance of a part number with a different primary key for each.

    Please let me know if anyone can help or if any more clarification is needed.

    Thanks!

  2. #2
    New Member
    Join Date
    Aug 2019
    Posts
    8
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Import Excel Data to Access Table - Retain Primary Keys

    Quote Originally Posted by chrisk1979 View Post
    I am working on an inventory database in Access. I have a build of materials list in Excel. The part numbers have prefixes, bases and suffixes. Some of the part numbers are on the build of materials multiple times. Some of the part numbers change occasionally (suffix only; prefix and base will always stay the same). The changes happen often enough (not only part suffix changes, but parts being added, deleted or moved around) that I want to automate the import process of the parts on this build of materials on a daily basis to make sure I keep up with all changes automatically.

    In Access, I am going to be keeping track of stock levels, invoicing, receiving new quantities, etc. - all kinds of activity which requires these parts to have a static primary key because I need to retain history and accurate stock levels of each part.

    How can I import this data from Excel into Access on a regular basis and have Access:
    1) Append any new parts (add to the end)
    2) Ignore any existing parts that haven't changed at all
    3) Replace or update part number (suffix) on those that have changed suffixes and retain its primary key, and therefore all its history, etc.

    AND I also only want every part on the build of materials in my Access table only ONCE regardless of how many times it appears on the build of materials Excel file - I don't want more than one instance of a part number with a different primary key for each.

    Please let me know if anyone can help or if any more clarification is needed.

    Thanks!

    Hello,
    Based on the dynamic nature of the excel file, if it were me I would link the excel file in Access. Any changes to the excel file will be realized in real time in the access table. Go here to learn how to link your excel file.
    https://support.office.com/en-gb/art...d-e084913cc958

    Search: Link to data in Excel on the web page

  3. #3
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,441
    Post Thanks / Like
    Mentioned
    11 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Import Excel Data to Access Table - Retain Primary Keys

    If prefix + base doesn't change then just make that the primary key.

    Although off the record I do wonder what problems may show up down the road if you are ignoring or otherwise updating suffixes. Don't they have some purpose?
    Last edited by xenou; Aug 8th, 2019 at 03:24 PM.

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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