Results 1 to 3 of 3
  1. #1
    jj1 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2014
    Posts
    128

    Merge query not working

    MERGE UserT AS target
    USING SUP/TLupdatedListQuery AS source ON target.Username = source.SUP/TLupdatedListQuery
    AND target.Password = source.PERSON T-ID
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (Field1, PERSON T-ID) VALUES (source.Field1, source.PERSON T-ID)
    WHEN NOT MATCHED BY SOURCE THEN
    DELETE;

    I am using this query and it's not working

    What I am trying to do is merge 2 tables
    I have Table 1 which has old records of employees their names and ID number
    and as employee change in the company so new list comes Table 2 is created I ran a query to pull employee name and ID to merge in table 1
    so some employee record remain same however some change so i need to delete few in old table and add new ones

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    I dont think MERGE is a command. If you built the query from the query design the only option would be append or union.
    Do you want to append the diffent data sets to a single table?

    or

    UNION:
    select * from table where set1
    union
    select * from table where set2


    or

    do you mean some of 1 table records combining with fields of another table.
    this is a join
    or
    update query.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,945
    I don't think MERGE is available in Access. As ranman noted, options are UNION or INSERT. You might want to do a Find Unmatched query to determine what data needs to be in the INSERT. There is a wizard for the Find Unmatched.
    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.

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

Similar Threads

  1. Replies: 6
    Last Post: 08-13-2014, 10:32 PM
  2. Query to merge matching data
    By kmullins76 in forum Queries
    Replies: 1
    Last Post: 09-05-2013, 02:58 PM
  3. Access Query to Word Merge
    By besuchanko in forum Import/Export Data
    Replies: 1
    Last Post: 02-24-2013, 05:17 PM
  4. Mail Merge from Access Query
    By Baldeagle in forum Reports
    Replies: 5
    Last Post: 03-17-2012, 06:43 PM
  5. Using a pass-through query in mail merge
    By ss1289 in forum Access
    Replies: 0
    Last Post: 09-17-2010, 08:58 AM

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