Results 1 to 3 of 3
  1. #1
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370

    Question Not returning all records

    Hello all,

    So I'm having a problem building a query.

    I have 3 tables total that I will be pulling information from.

    Table1 has 3 fields (field1, field2, and field3) that are linked to Table2

    Table1 also has 2 fields (fieldA, fieldB) linked to Table3

    A regular Query on table 1 returns 627 records.

    Once I add Table2 to the Query, I delete the relationship of three fields, and make it to a single field (field1). (the reason I do this is because if I leave the Table linked to 3 fields, it returns no records.

    Now when I run the query I'm only getting 412 records. The ones that are missing either have the value 0 or Null for that field (field1), How do I allow the query to return these records as well?

    I tried looking into the Nz() function but I couldn't quite grasp how to use it in the query builder, anyone mind explaining to me?

    Thanks

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    It's because some records in table1 do not have related records in table2. You need to make the relationship an outer join. (for A2010) Right-click the join between the two tables, select Join Properties, then select the option that says "Include ALL records from table1....".

    That should give you all table1 records.

    If there are records in table2 that have Null or 0 in field1, you cannot get them - there are no records in table1 to join them to. You could have the outer join the other way - "include ALL records from table2....", but it depends on what you need.

  3. #3
    cbende2's Avatar
    cbende2 is offline Competent Performer
    Windows 7 32bit Access 2013
    Join Date
    Jun 2014
    Location
    Louisiana
    Posts
    370
    Ok thanks!

    After thinking and talking with my boss, we decided on having a record named "Unassigned" which actually fits our needs better. I simply ran an update query on all 0 and Null values to update to ID of Unassigned.

    Thanks for helping though John_G!

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

Similar Threads

  1. Query not returning records
    By Daryl2106 in forum Access
    Replies: 2
    Last Post: 02-28-2013, 07:58 PM
  2. Query not returning records
    By Daryl2106 in forum Access
    Replies: 2
    Last Post: 11-28-2012, 09:29 AM
  3. Query Criteria not returning any records
    By SgtSaunders69 in forum Access
    Replies: 2
    Last Post: 12-19-2011, 07:45 PM
  4. Recordset not returning records
    By TinaCa in forum Programming
    Replies: 3
    Last Post: 08-03-2011, 09:26 AM
  5. Returning multiple records Isn't what I need
    By frobro390 in forum Queries
    Replies: 6
    Last Post: 09-21-2010, 06: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