Results 1 to 3 of 3
  1. #1
    rbctemp is offline Novice
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    3

    Query returning no field/result, need to show 0

    Hi,



    I need some assistance modifying the following query.

    Query details:
    Filters and counts 2 columns of a data based on 2 criteria:
    Pipeline = “Level Number”
    Name = “Y”
    Both criteria must be met in order to be counted.

    The query works fine if both criteria involve numbers, however if at least one field is blank/zero, the counter doesn’t return anything (no field at all // blank). I need the counter to return a “0” if the criteria aren’t met, yet still return the actual number in the case that it isn’t a zero.

    I’ve tried using the Nz([field], 0) in the field section of my query but it doesn’t seem to work. Below is my code.

    Code:
    SELECT Count("") AS [Counter:]
    FROM [Database]
    GROUP BY Database.Pipeline, [Name]
    HAVING (((Database.Pipeline)="Level Number") AND (([Name])="Y"));
    Thanks.

  2. #2
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    I saw something before about this recently and using a custom function called nnz, I'll have a look and see if i can find the thread.

  3. #3
    R_Badger is offline Knows a few tricks
    Windows XP Access 2003
    Join Date
    Feb 2012
    Location
    Suffolk, UK
    Posts
    262
    I found the thread about it here:

    https://www.accessforums.net/reports...all-25075.html

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

Similar Threads

  1. Query Help - Show field if another field is null
    By lukekonrad in forum Access
    Replies: 1
    Last Post: 03-05-2012, 04:02 PM
  2. Replies: 7
    Last Post: 01-11-2012, 12:24 PM
  3. Replies: 1
    Last Post: 09-28-2011, 09:48 PM
  4. Query result based upon two field conditions
    By diane802 in forum Access
    Replies: 35
    Last Post: 01-08-2010, 06:31 PM
  5. Replies: 1
    Last Post: 07-12-2009, 05:09 PM

Tags for this Thread

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