Share via

Error using iif function

Anonymous
2024-03-16T21:59:45+00:00

When using the iif function I get an error that says 'you omitted an operand or operator, you entered an invalid character or comma, or you entered text without surrounding it in quotation marks'. I get this even when I try:

iif((1+1=2),"yes","no")

I've been working on this for a few hours, trying different things. I called MS support and apparently this is the only forum to get help. Having that function for the work I'm doing is critical. Any suggestions please?

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

24 answers

Sort by: Most helpful
  1. George Hepworth 22,855 Reputation points Volunteer Moderator
    2024-03-17T04:03:44+00:00

    First, is the exactly the expression you evaluate in your Access relational database application, or is it just made up for this forum?

    I ask because it returns the correct response for me, and it seems like a useless expression on the face of it.

    If you created a "sample" for the forum, that's okay, but if the actual expression is something else, we need to see it.

    Also, what are the regional settings in your installation? As Hans pointed out, that makes a difference in which delimiter you need here.

    Please verify the details for us.

    Thanks.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-03-17T01:52:38+00:00

    I'm sorry, this isn't helpful to me. I've used MS Access for many years, the query builder usually works like a charm but suddenly doesn't. Not sure what the code above is but it's nothing I've ever used or seen before and wouldn't know where to begin. Thank you however for the suggestion, I'm just looking to get it to work as it always has. Again, with the version being 2402 I don't think it's unreasonable to think there may be a bug in this version and am hoping someone form MICROSOFT will look into it. Very frustrating as a home user to pay for Access and then learn from Microsoft that they don't support this product, that this chat of dedicated users is my only option. So I thank you all for your help but just want the product to work as it should and am hoping someone who can fix it or explain why it's not working as it always has will chime in. Also, it goes without saying that the inane error message, "you omitted an operand or operator, you entered an invalid character or comma, or you entered text without surrounding it in quotation marks" is useless. Especially when none of these circumstances is at play.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-03-17T01:47:19+00:00

    I just re-booted and have the same error.

    How does one go about repairing the MS 365 installation?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-03-16T23:56:29+00:00

    VBA?

    Set Conn2 = CreateObject("ADODB.Connection")

    Set Rst=CreateObject("ADODB.Recordset")

    path="D:\wwwroot\HA626046\WEB\Bsbm\stu60\vba\up\upload\update_two_tbl.db"

    Conn2.Open "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & path

    'double quote?

    SQL="select *,iif((1+1=2),""yes"",""no"") from tbl order by description desc"

    'Set Rst = Conn2.OpenSchema(20)

    set Rst=Conn2.execute(sql)

    Was this answer helpful?

    0 comments No comments
  5. HansV 462.6K Reputation points
    2024-03-16T22:43:43+00:00

    I assume that you have restarted your computer at least once.

    If so, I'm stumped. You might try repairing your Microsoft 365 installation.

    Was this answer helpful?

    0 comments No comments