Results 1 to 5 of 5
  1. #1
    scoe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    91

    Syntax error

    Hi
    I'm sure I'm missing something very silly here, I have the following IIf statement that works perfectly when put into a query but brings up the Syntax error "Syntax error(comma) in query expression", when I put it in a test box in a report.



    The statement is:
    [IIf([Column]="CP16",([SumOfTotal]))]

    I would appreciate any pointers as to why this is not working.

    Thank you.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The IIF function requires both an If-True and an If-False argument.
    IIF([Test],If True,If False)

  3. #3
    scoe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    91
    Hi

    I have tried that and still no joy, I have tried:
    [IIf([Column]="CP16",[SumOfTotal],""] and [IIf([Column]="CP16",[SumOfTotal],"0"]
    and as I mentioned, the previous works pefectly in a query but not in the text box.

  4. #4
    scoe is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2013
    Posts
    91
    Found the problem, the report had developed a bug lol....Opened a new form and the statement works fine, thank you for your help.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks for posting back with your success and solution.

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

Similar Threads

  1. Replies: 3
    Last Post: 03-05-2013, 11:17 AM
  2. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  3. Replies: 6
    Last Post: 05-30-2012, 12:32 PM
  4. Replies: 5
    Last Post: 03-27-2012, 01:40 PM
  5. Incomplete Syntax Clause (syntax error)
    By ajetrumpet in forum Programming
    Replies: 4
    Last Post: 09-11-2010, 10:47 AM

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