IIF Statement NOT working with number logic tests

Anonymous
2021-04-14T12:57:58+00:00

I have a simple IIF statement;

IIF ([Marks]>50,"Pass","Fail")

But Access returns a syntax error. I have tried the IIF statement with Dates it works. I can even add marks onto existing mark, meaning all functions works but only when the logic test has to deal with numbers then I have a problem. Please help!!!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} vote

14 answers

Sort by: Most helpful
  1. Duane Hookom 26,575 Reputation points Volunteer Moderator
    2021-04-14T13:09:39+00:00

    There might be multiple rows in the expression that are hidden. Can you view the SQL view of the query? Can you confirm Mark is a numeric data type?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2021-04-14T13:13:15+00:00

    Yes indeed, the "Mark" field is a 'Number' field. No hidden fields.

    0 comments No comments
  3. Duane Hookom 26,575 Reputation points Volunteer Moderator
    2021-04-14T13:17:16+00:00

    How about the SQL view? Can you copy the SQL statement and paste it into a reply?

    Is there a reason you don't have the Show box checked?

    0 comments No comments
  4. Anonymous
    2021-04-14T13:24:48+00:00

    Verdict: IIF([Mark]>50,"Pass","Fail")

    I'm not too familiar with SQL. 

    0 comments No comments
  5. Duane Hookom 26,575 Reputation points Volunteer Moderator
    2021-04-14T13:32:39+00:00

    While in the design view drop down the View and select SQL view. Then copy the SQL statement and paste into a reply.

    0 comments No comments