Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521

    I think you can attach a zipped file; did you try that?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    thanks,
    I'll try that.

  3. #18
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50

    Database copy

    Joe
    did this work?
    I can't tell if it attached or not.
    I have created a zip file and uploaded it.

  4. #19
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Sorry, I have been away for a few days.

    I was able to successfully download your database. Can you let me know which query exactly is the issue, and what record is missing exactly?

  5. #20
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    The query is called:
    Qry_AggregateResultsAllAgencies. It's the second one down in the query's

  6. #21
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    I'm not sure what all records are missing but I do know that I am missing records from the agency US Marshals (San Antonio. I know for a fact that there were zero records that met the CCS>0 criteria.

  7. #22
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    OK, in looking at your query, I think I see your problem, and it goes back to something I said back in post #6.
    You have multiple data sources in this query, and they all seem to be linked to each other by INNER JOINS. When you do this, the only UNITS that will show up are UNITS found in EVERY single one of your sources that are joined like this.

    What I recommend doing is creating a query (or using a table) that has all our your units listed (and listed exactly once). Then, from this source, do a LEFT OUTER join to all of your other data sources.
    See this link for details on how to set-up left joing: http://www.techonthenet.com/access/queries/joins2.php
    When you read the explanations of each of the different join options, it makes more sense.

  8. #23
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    Thanks again Joe.
    I believe that I have tried this approach but I will go back and try again. I already have a table only for Units.
    I will get back to you in a day or so and let you know how it works out.

  9. #24
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I believe that I have tried this approach but I will go back and try again.
    Yes, all the joins in that query are Inner Joins (no Left Joins).
    How I typically like to approach ones like these is to create a query that lists each record that I want to see, and then use this as the main data source of my query, and then link all the other tables/queries to this one using Left Joins (so no records from that "main" data source are dropped.

    You can then use the NZ function to return zeroes instead of nulls for any fields that may not have matching records in the other tables/queries.
    See: http://www.techonthenet.com/access/f...dvanced/nz.php

    So if you have a numeric field, the formula would look something like:
    NZ([FieldName],0)

  10. #25
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    Sorry, I missed this posting. will investigate my ability to make this work also.
    I will get back to you

  11. #26
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    this worked nicely Joe.
    However, is it possible to use the NZ function to return zeros for a calculated expression. For example, I have a field that I am calculating % based on two other fields within the query. Here is the syntax for the expr.

    expr: Round((([CCS >0]+[CountOfID11])/[SumOfCountOfID1])*100,2)
    I have tried a number of ways to include the NZ function but it keeps dinging at me. Of note, I have used the NZ function on both of the fields named in this calculation {CCSS>0 and [CountOfID11].

  12. #27
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    Never mind Joe, I figured it out. Was trying to use the brackets when I didn't need to.

  13. #28
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Excellent! Glad you got it all working now.

  14. #29
    MLangendorf is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Jun 2016
    Posts
    50
    Using the Nz function resolved my issues.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 06-09-2015, 09:51 AM
  2. Query for excluding TOP N records
    By dolovenature in forum Queries
    Replies: 1
    Last Post: 09-14-2012, 03:49 PM
  3. Excluding phone numbers using a query
    By Scott O'Neal in forum Queries
    Replies: 1
    Last Post: 09-06-2012, 11:04 AM
  4. Insert entire row from query into new row in another table
    By chris.williams in forum Programming
    Replies: 3
    Last Post: 10-13-2011, 01:38 PM
  5. Excluding data in a query
    By lpdds in forum Queries
    Replies: 1
    Last Post: 12-16-2009, 08:06 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