Results 1 to 3 of 3
  1. #1
    heinensk23 is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    13

    Table that can be auto updated with new information

    I have a current table which is a list of items with costs.
    Daily, I want to check the base table with a new table of costs.


    The new table may have new items, but also may have some items that match the original table but with updated costs. Although the new table may not contain all the items that are on the original table.

    I want to be able to do a match of the new table to the original table.
    If there is a new item from the new table it would get added to the original table.
    If there is a matching item already on the list, I would want the original table to now show the updated cost for that existing item.

    I know how I would do this manually in excel.
    Is there a way to do this automatically in access?

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    if your table is keyed to prevent duplicates, then just run 2 queries:
    1. and append query (to add new items. existing items will be ignored due to keys)
    2. run update query, (to update all with new costs)
    done.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    you could try what is called an upsert query which will add new records and update existing ones in one hit - syntax is along these lines

    UPDATE (S LEFT JOIN D ON D.ID=S.ID) SET D.F1 = S.F1, D.F2 = S.F2, D.F3 = S.F3 etc

    S=source table (your 'new' table)
    D=destination table (your 'original' table)
    ID - a field which uniquely matches between the two tables (in your case might be an item code or name)
    F1, F2, F3 - field names (can be different in each table), include all fields you want to get appended - so if item code is your ID, include it here as well

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

Similar Threads

  1. Replies: 5
    Last Post: 11-24-2017, 10:57 PM
  2. Replies: 1
    Last Post: 10-24-2016, 06:58 AM
  3. Replies: 2
    Last Post: 09-15-2011, 09:59 AM
  4. Replies: 1
    Last Post: 09-14-2011, 07:50 AM
  5. Replies: 1
    Last Post: 09-08-2011, 06:36 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