Results 1 to 2 of 2
  1. #1
    Lorlai is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    107

    Append if record doesn't exist

    I am trying to create an append query if the record does not exist in the table. I have two table, Product_Details and a temp table. They contain basically the same information, with the exception of the temp table having minor updates. I am trying to see if there is a new record in the temp table, and if so, then append it to the Product_details.



    Product_Details:

    ID Name Qty Color Zip
    12 Hammer 2 red 80976
    13 nail 900 silver 76532

    Temp:

    ID Name Qty Color Zip
    12 Hammer 2 Black 80976
    13 nail 900 silver 76532
    14 Glue 6 blue 23412

    My current statement is through the access UI query:
    Field: Name
    Table: Temp
    Sort:
    Append To: Product_Details.Name
    Criteria: [Temp].[ID] Not Like [Product_Details].[ID]
    or:

    This yields nothing. Any idea what I can do so that it will add the records that are not present in Product_Details?

    Thank you!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,895
    You need to do something like:
    INSERT into Product_Details SELECT FROM Temp WHERE NOT Product_Details.ID HAVING Temp.ID;

    Just not sure of the syntax. Check this http://bytes.com/topic/sql-server/an...sert-procedure
    or this http://www.eggheadcafe.com/microsoft...not-exist.aspx
    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. If record does not exist, open add new record form
    By RobertIngles in forum Programming
    Replies: 2
    Last Post: 02-01-2011, 08:47 AM
  2. Replies: 9
    Last Post: 12-18-2010, 12:51 PM
  3. Replies: 2
    Last Post: 10-13-2010, 07:09 AM
  4. Form doesn't exist
    By Back2Basics in forum Access
    Replies: 1
    Last Post: 02-01-2010, 11:39 AM
  5. importing csv file to append record
    By Tim Hardison in forum Import/Export Data
    Replies: 1
    Last Post: 01-14-2010, 04:24 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