Results 1 to 3 of 3
  1. #1
    weswilson88 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    7

    Update on Import

    Hello, I am trying to update a table based of Excel spreadsheets that are sent to me daily. The data on the Excel spreadsheet has a Unique ID that corresponds with the Unique ID in the Access table. The problem that I run into is that if the Unique ID already exists in the Access Table then Access will ignore it. What I would like is for Access to overwrite all of the other fields of the Unique ID record for ones that exist and Add records for the Unique ID's that are not already in Access. I have read quite a bit about update queries and using two tables but I cannot seem to get anywhere with it. If there is any examples or suggestions you can refer to me I would appreciate it. Thank you.

  2. #2
    Dal Jeanis is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Here's my suggestion. This assumes that the Unique ID key field is NOT autonumber. If it is autonumber and needs to remain so, then your problem will require a different strategy to solve.

    First, before writing and testing the routine, back up your database.

    Second, set up the routine in a VBA module to do this -

    1) Import the data into a temporary version of the table.
    (test, and when it's working, back it up.)

    2) Delete all records in the main table which have a matching key in the temp table.
    (test this by manually entering one or two keys at a time in the temp table,
    and when it's working, back it up.)

    3) Insert new records into the main table for each record in the temp table
    (test this using the above two facilities, and when it's working back it up.

    4) Delete the temp table.
    (you know what I'll write here)

    Third, once that is all tested, take a brand new backup of the main database, copy just the VBA module into it, and test all functions. If they work, then you can move it to production.

    If not, then you changed something else in your testing. Find that something else. Repeat with fresh copies of the production backup until you can install
    your new features without a glitch.

  3. #3
    weswilson88 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2013
    Posts
    7
    I will give this a shot. Thank you.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-23-2013, 12:17 PM
  2. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  3. Batch Import and Update from DBF
    By Lady_Jane in forum Import/Export Data
    Replies: 7
    Last Post: 02-08-2011, 02:57 PM
  4. Replies: 1
    Last Post: 01-22-2011, 12:23 PM
  5. auto import and update on startup
    By MrFurley in forum Import/Export Data
    Replies: 2
    Last Post: 10-01-2010, 05:54 PM

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