Forum Discussion

Clayton_cramer's avatar
Clayton_cramer
Copper Contributor
Feb 02, 2021

Re: Inserting empty rows

IIF needs an expression and two values for TRUE and FALSE evaluations of the expression.  It should return a single VALUE and SUM should add all those values for all rows.  What you provided makes perfect sense--except to Access, which is still complaining about wrong number of arguments.  It is almost like IIF does not recognize that expression.

6 Replies

  • Gustav_Brock's avatar
    Gustav_Brock
    Iron Contributor

    Clayton_cramer If you don't like IIF, then use IN:

    SELECT 
        year, 
        Abs(Sum([cause_ID] In (15, 16))) AS incidents
    FROM 
        Table2
    GROUP BY 
        year;
  • George_Hepworth's avatar
    George_Hepworth
    Silver Contributor

    Clayton_cramer If you can, I would like some sample data to work with in order to see what might the problem is. Thanks.

    BTW.  Access most definitely will evaluate the expression once it is properly written, so please include your query with that expression with the sample data. Thanks.

    • Clayton_cramer's avatar
      Clayton_cramer
      Copper Contributor

      George_HepworthI tried attaching the database:

      Correct the highlighted errors and try again.

      • The attachment's massmurder.accdb content type (application/msaccess) does not match its file extension and has been removed.
    • Clayton_cramer's avatar
      Clayton_cramer
      Copper Contributor

      I am embarrassed to say that I cannot figure out how to export my database with just a few records in it, so it is a size that I can upload.

Resources