Results 1 to 4 of 4
  1. #1
    Rin is offline Novice
    Windows 10 Access 2016
    Join Date
    Nov 2018
    Posts
    9

    Question Update vs Append

    I have an external table "NewData" from which I need to add missing data and update existing data in an internal table, tblAgents. If I create an Update Query I know it will update the existing record data in tblAgents, but will it add records that are missing? Do I need to create an Append Query to run first?

    I know this is a pretty elementary question - I'm just getting started in Access.

    Thanks,

    ~Rin

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Could run INSERT and UPDATE actions.

    However, might be able to accomplish both in a single UPDATE query. Often referred to as UPSERT. Review https://stackoverflow.com/questions/...g-in-ms-access
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    A standard UPDATE will just update existing records but will not add new records.
    So the normal solution is an UNMATCHED APPEND query followed by an UPDATE.

    However as June said it is sometimes possible to combine these using an UPSERT (aka UPEND) query which has a left join between your two tables.
    Here's another explanation on my website with some examples which may be helpful http://www.mendipdatasystems.co.uk/u...ery/4594428616
    If you understand how it works, then it may save you time.
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Rin,

    In addition to the advice offered by June and Colin, here are a few questions to help with the logic of the process. If "NewData" records could consist of multiple (more than 1) records/transaction for a given record in tblAgents or within "NewData" itself, then the sequencing of "updating or inserting" could be critical to your situation.
    This may be obvious, but for clarity, if the "NewData" is related to Dates (hireDate, changeDate...) then you'll have to ensure the changes respect this.
    Good luck.

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

Similar Threads

  1. Append+Update+Dublicates
    By Akcess in forum Access
    Replies: 1
    Last Post: 12-29-2016, 07:28 AM
  2. Append and update
    By Homegrownandy in forum Queries
    Replies: 4
    Last Post: 02-29-2016, 09:20 AM
  3. Update existing and append new
    By krausr79 in forum Access
    Replies: 2
    Last Post: 10-29-2015, 10:03 AM
  4. Run Append and Update Queries
    By Govinda in forum Programming
    Replies: 1
    Last Post: 04-04-2013, 01:14 AM
  5. Update or Append Query
    By Ran in forum Access
    Replies: 8
    Last Post: 01-06-2012, 12:15 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