Results 1 to 3 of 3
  1. #1
    Kramnation is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2005
    Posts
    2

    Finding not matching on multiple fields

    Hi all,

    I’m trying to append any new data from one table to a table in my Db. I will run this query on a timer and would like to append any new data from the source table. The source table has no primary key so having a hard time using the not matching wizard (only can select 1 field as Is Null).

    Using my table example below, how would I append (Insert) the 2 records that are missing?

    I’m using this code, but it will miss the 3rd record

    W00001 0001 0003 In Office

    INSERT INTO tbJOB_DTL_TEXT_hold ( JOB, SEQUENCE, KEY_SEQUENCE, [TEXT], JOB, SEQUENCE, KEY_SEQUENCE )
    SELECT JOB_DTL_TEXT.JOB, JOB_DTL_TEXT.SEQUENCE, JOB_DTL_TEXT.KEY_SEQUENCE, JOB_DTL_TEXT.TEXT, tbJOB_DTL_TEXT_hold.JOB, tbJOB_DTL_TEXT_hold.SEQUENCE, tbJOB_DTL_TEXT_hold.KEY_SEQUENCE
    FROM JOB_DTL_TEXT LEFT JOIN tbJOB_DTL_TEXT_hold ON JOB_DTL_TEXT.[JOB] = tbJOB_DTL_TEXT_hold.[JOB]
    WHERE (((tbJOB_DTL_TEXT_hold.JOB) Is Null) AND ((tbJOB_DTL_TEXT_hold.SEQUENCE) Is Null) AND ((tbJOB_DTL_TEXT_hold.KEY_SEQUENCE) Is Null));

    Source Table

    Job Sequence Key Sequence Text
    W00001 0001 0001 Error on
    W00001 0001 0002 PC located
    W00001 0001 0003 In Office


    W00002 0001 0001 Passed
    W00003 0001 0001 Passed
    W00003 0002 0001 Passed
    W00004 0001 0001 Passed


    My table

    Job Sequence Key Sequence Text
    W00001 0001 0001 Error on
    W00001 0001 0002 PC located

    W00002 0001 0001 Passed
    W00003 0001 0001 Passed
    W00003 0002 0001 Passed

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    a multi field no-match is challenging. because you are only dealing with 4 fields you should be able to do this:
    make a query of the table and include a new calculated field that puts all the data together i.e. All: [Job] & [Sequence] & [Key Sequence] & [Text]

    do that for both tables so you have 2 saved queries....

    then make your no match query using these 2 saved queries with the join on the All field

    I think that will work...

  3. #3
    Kramnation is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2005
    Posts
    2
    Very cleaver, works great! I appreciate the help.

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

Similar Threads

  1. Linking/Matching multiple IDs
    By brownk in forum Queries
    Replies: 17
    Last Post: 08-16-2016, 04:52 AM
  2. Finding calculated fields
    By Geo21 in forum Forms
    Replies: 7
    Last Post: 06-22-2014, 05:54 PM
  3. Replies: 1
    Last Post: 08-11-2011, 11:33 AM
  4. Concatenating fields from matching records
    By MWMike in forum Queries
    Replies: 1
    Last Post: 10-28-2010, 10:49 PM
  5. Replies: 5
    Last Post: 03-20-2010, 08:30 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