Results 1 to 5 of 5
  1. #1
    Jray9242 is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14

    Duplicate entries and calling query from Form

    I created a query that I thought would only add new records. I seem to work if I call the query standalone, but when I call it from the form, it adds all the records. I have included the SQL and the command I use to call the Query.



    FName should be a unique name.

    Thank you for the help.

    QUERY:

    INSERT INTO [Catalog] ( FName, FPath, FileLink )
    SELECT CatalogImport.FName, CatalogImport.FPath, CatalogImport.FileLink
    FROM CatalogImport LEFT JOIN [Catalog] ON Catalog.FName = CatalogImport.FName
    WHERE Catalog.FName Is Null;

    FORM:

    DoCmd.OpenQuery "MergeData"

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Should it be

    WHERE CatalogImport.FName Is Null;?

  3. #3
    Jray9242 is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14
    Catalog is the master table and the Import is the Import table. So if Fname exist in Catalog, don't add it.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    INSERT INTO [Catalog] ( FName, FPath, FileLink )
    SELECT CatalogImport.FName, CatalogImport.FPath, CatalogImport.FileLink
    FROM CatalogImport LEFT JOIN [Catalog] ON CatalogImport.FName = Catalog.FName
    WHERE (((Catalog.FName) Is Null));

    Swap the fields after ON

  5. #5
    Jray9242 is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    14
    Nice!

    Thank you for the help.

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

Similar Threads

  1. Replies: 5
    Last Post: 04-15-2016, 08:17 PM
  2. Stop Duplicate entries in a sub form
    By Headford in forum Forms
    Replies: 1
    Last Post: 03-04-2014, 09:52 AM
  3. Query Resulting In Duplicate Entries
    By kestefon in forum Access
    Replies: 5
    Last Post: 12-04-2013, 03:28 PM
  4. Remove Duplicate Entries in Query Design
    By samanthaM in forum Access
    Replies: 1
    Last Post: 10-27-2013, 11:26 AM
  5. Replies: 1
    Last Post: 12-09-2011, 07:34 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