Results 1 to 3 of 3
  1. #1
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318

    Union of query with blank information


    I have two query's. One that shows a list of buildings with post inspection dates "Q_PI_Qrtly_Insp_Ct_Range_Count" and one that shows a list of buildings that all have posts "Q_PI_Qrtly_Insp_Ct_Range_Blank". What I am trying to do is create a union of sorts that will give me a list of all the buildings with the count of the post inspections performed and if there were no post inspections performed then list those buildings with a zero or blank. Even if I have to have two seperate lists that would be OK but I can not figure out how to get a list of buildings where no post inspections were performed. I've attached a sample of the database. In other words my "Q_PI_Qrtly_Insp_Ct_Range_Blank" query doesn't work.
    Attached Files Attached Files

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I cannot download open your database from my present location, but here is how I have approached problems like this in the past.

    1. Do you have a table of just all the buildings you want to return? If not, create a query that returns each building you want to see exactly once.
    2. If you have not already done so, create a query which returns a count of all the post inspections (grouped by building)
    3. Create a query, doing a LEFT JOIN from the object in step 1 above, to the object in step 2 above (this will return a record for ALL buildings)
    4. Create a calculated field to return the count using the NZ function to return a zero in the instance of no match, something like:
    Code:
    Post_Inspection_Count:NZ([Total_Inspection_Count],0)+0
    I think that should give you what you are looking for.

  3. #3
    Huddle is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Jun 2010
    Posts
    318
    That worked just fine. Thanks

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

Similar Threads

  1. Replies: 17
    Last Post: 08-27-2013, 10:21 PM
  2. Replies: 8
    Last Post: 10-22-2012, 07:43 PM
  3. Replies: 1
    Last Post: 01-20-2012, 04:31 PM
  4. Need help with a Union Query
    By jdowdy in forum Access
    Replies: 1
    Last Post: 10-13-2009, 05:24 PM
  5. Replies: 1
    Last Post: 09-05-2008, 12:07 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