Results 1 to 8 of 8
  1. #1
    efmbman is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    14

    Add Count to a Report with multiple Null Criteria (Expression Builder Syntax)

    Sorry if this has been asked/answered elsewhere. My search ability is limited based on my knowledge of terms...



    I have a report in which I would like to add some counts based on a table. Here is the statement I have that returns an error:

    = Count ( [FormData]![INITSTFF] Is Not Null , [FormData]![INITVET] Is Null , [FormData]![DISCHRG] Is Null )

    FormData is my table.
    INITSTFF, INITVET, and DISCHRG are date fields.

    The error is get is: "The expression you entered has a function containing the wrong number of arguments."

    What am I doing wrong?

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    What are you trying to count?

    Any item where INITSTFF is not null AND INITVET AND DISCHRG are both null?

    if you wanted that you'd have to have

    =sum(iif(not isnull(initstff) AND (isnull(INITVET) AND (isnull(DISCHRG)), 1, 0))

  3. #3
    efmbman is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    14
    Quote Originally Posted by rpeare View Post
    What are you trying to count?

    Any item where INITSTFF is not null AND INITVET AND DISCHRG are both null?

    if you wanted that you'd have to have

    =sum(iif(not isnull(initstff) AND (isnull(INITVET) AND (isnull(DISCHRG)), 1, 0))
    Thanks, but still get the same error.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    look at the bracketing

    =sum(iif(not isnull(initstff) AND (isnull(INITVET) AND isnull(DISCHRG)), 1, 0))

  5. #5
    efmbman is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    14
    Quote Originally Posted by rpeare View Post
    look at the bracketing

    =sum(iif(not isnull(initstff) AND (isnull(INITVET) AND isnull(DISCHRG)), 1, 0))
    Yep... found it. All the [()] add up now. However, a new error appears: "The specified field could refer to more than one table listed in the FROM clause of your SQL statement."

    I did not type the field names, I chose them using the expression builder thinking that was the best way to point at the correct item. I have no idea how to even get at the SQL...

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    so put your table name back in then

    [tablename]![fieldname]

  7. #7
    efmbman is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    14
    Quote Originally Posted by rpeare View Post
    so put your table name back in then

    [tablename]![fieldname]
    Right, I did that from the beginning assuming you were doing the example shorthard. I do appreciate the help, but it seems I am getting nowhere.

  8. #8
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Then there's some other field in your query that you're using in a formula that could be from multiple tables, look at all your formula fields and examine them for field names that occur in more than one table.

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

Similar Threads

  1. Expression Builder Syntax Problem
    By maxmaggot in forum Queries
    Replies: 7
    Last Post: 06-14-2013, 08:29 AM
  2. Report - Expression Builder
    By AndreasPanayiotou in forum Reports
    Replies: 3
    Last Post: 09-16-2012, 01:10 AM
  3. Replies: 30
    Last Post: 08-15-2012, 02:25 PM
  4. Count if Null Expression
    By Huddle in forum Reports
    Replies: 3
    Last Post: 03-07-2012, 04:43 PM
  5. Replies: 1
    Last Post: 02-25-2011, 06:11 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