Results 1 to 3 of 3
  1. #1
    F.M. is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    2

    Query of 2 fields that do not occur in another table

    Hi there,

    I'm struggling with a query that should show all records if both 2 fields in that table do not match one field in another table.

    Table 'Callviewer' has severall fields, but 2 of them 'WeCalledThemNr' and 'TheyCalledUsNr' contain telephonenumbers. I want to check these numbers with table 'Checknr' field 'PhoneNr'. If both numbers do not match with 'Phonenr' I want that record to be shown in the query.



    When I both leftjoin the fields from CallViewer to CheckNr it reacts like and OR statement.... so 'Show the record if WeCalledThemNr is not equal to PhoneNr' or 'Show the record if TheyCalledUsNr is not equal to PhoneNr' .... so actually every record ends up in the query.


    SELECT [Callviewer].[WeCalledThemNr], [Callviewer].[TheyCalledUsNr]
    FROM [Callviewer] LEFT JOIN CheckNr ON [Callviewer].[WeCalledThemNr] = CheckNr.[PhoneNr] AND [Callviewer].[TheyCalledUsNr] = CheckNr.[PhoneNr]
    GROUP BY [Callviewer].[WeCalledThemNr], [Callviewer].[TheyCalledUsNr], CheckNr.PhoneNr
    HAVING (((CheckNr.PhoneNr) Is Null));


    Anyone a clue how to make sense?

    Thanks for your time and attention.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    if you are doing 2 fields, you may not get the result you think. The logic is prob: not in Fld1 but is in Fld2 and vice versa.
    Try doing only 1 at a time.
    Q1 to find whats not in fld1
    Q2 using Q1 to find , not in fld2

  3. #3
    F.M. is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2016
    Posts
    2
    Refreshingly easy point of view.... Thnx Ranman!

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

Similar Threads

  1. Replies: 2
    Last Post: 05-20-2014, 02:28 PM
  2. Trigger A Reminder to Occur At A Later Date
    By wes9659 in forum Access
    Replies: 7
    Last Post: 04-23-2014, 01:01 PM
  3. Count values that occur consecutively
    By WickidWe in forum Queries
    Replies: 15
    Last Post: 12-11-2013, 07:19 PM
  4. Replies: 1
    Last Post: 08-01-2013, 12:24 PM
  5. Control when Saves occur
    By caddcop in forum Forms
    Replies: 0
    Last Post: 04-05-2011, 04: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