Results 1 to 6 of 6
  1. #1
    Charlie24 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2022
    Posts
    2

    Decode an IIf query

    Appreciate help understanding the following IIf statement:
    ExclusionSW: IIf(([CallType] Like "Insurance*") And ([CallType2] Is Null),1,IIf(([CallType] Like "ChgOrder*") And ([ProductLine] Is Null),1,0))

    Thank you

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,371
    I don't see how this can work but:

    if [Caltype] has word "insurance" in it AND [Caltype2] is null
    then show 1

    else
    if Caltype has word "ChgOrder" in it AND ProductLine is null,
    then show 1

    else
    show 0

  3. #3
    Charlie24 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    May 2022
    Posts
    2
    Quote Originally Posted by ranman256 View Post
    I don't see how this can work but:

    if [Caltype] has word "insurance" in it AND [Caltype2] is null
    then show 1

    else
    if Caltype has word "ChgOrder" in it AND ProductLine is null,
    then show 1

    else
    show 0
    Thanks for the response. Perhaps I should have shared the following information.

    The statement posted is in one of the Query fields and 0 is in the Criteria. Does this help?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,439
    Just a minor change to ranman's response.

    if [Caltype] starts with "insurance" in it AND [Caltype2] is null
    then show 1

    else
    if Caltype starts with "ChgOrder" in it AND ProductLine is null,
    then show 1

    else
    show 0

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    51,752
    Could modify with OR:

    ExclusionSW: IIf(([CallType] Like "Insurance*" And [CallType2] Is Null) OR ([CallType] Like "ChgOrder*" And [ProductLine] Is Null), 1, 0)
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    3,333
    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

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

Similar Threads

  1. Can someone decode this code in layman's terms
    By ItsJustMe3377 in forum Modules
    Replies: 3
    Last Post: 10-19-2017, 11:16 AM
  2. decode expression question
    By redhonda9834 in forum Queries
    Replies: 5
    Last Post: 11-24-2015, 10:13 AM
  3. how to decode a string of numbers
    By cjlieber in forum Programming
    Replies: 4
    Last Post: 04-16-2012, 06:50 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