Results 1 to 4 of 4
  1. #1
    RAJESHKUMAR R is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2017
    Posts
    48

    Syntax Error in SUMIIF Query

    Dear Friends,

    I am trying to create below SUM IIF in one of the Query, when I am trying to run the query... It is popping up as "Syntax Error"...

    Code:
    Expr1: Sum(IIf([Database]![cable_type]=[Database]![cable_type],[Database]![Net Inventory],0))
    Could you please help me to understand what am I doing wrong here?

    Thanks & Regards,
    Rajeshkumar R

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Are you sure it is that?, as this works fine for me?
    Code:
    SELECT Transactions.Description, Sum(IIf([description]=[description],1,0)) AS Expr1
    FROM Transactions
    GROUP BY Transactions.Description;
    However, how could cable_type ever be different?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    I think you need to have your criteria in the criteria row.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Your thread title says 'syntax error in query' so why are you just showing the expression? Show the entire query sql and maybe we'll see the problem.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 14
    Last Post: 12-24-2021, 02:28 AM
  2. Query - Sumiif
    By Jishnu Surendran in forum Queries
    Replies: 23
    Last Post: 03-12-2018, 12:34 PM
  3. Replies: 11
    Last Post: 05-01-2014, 11:56 AM
  4. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  5. Replies: 6
    Last Post: 05-30-2012, 12:32 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