Results 1 to 3 of 3
  1. #1
    dnlhmpt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    4

    Question Iif in another Iif with a Right oh my!

    So I am checking for premise numbers with an r or an l in them. If they have either I want to trim the r or l off and then set the length to 9. It has given me many headaches so far!



    Originally I had this. It works great too btw!
    PremiseNum: Right(IIf([dbo_meterchange].[premisenum] Like "*r",Left([dbo_meterchange].[premisenum],Len([dbo_meterchange].[premisenum])-1),[dbo_meterchange].[premisenum])+1000000000,9)

    I have added the new iif and it blows up. Please see below:
    PremiseNum: Right(IIf([dbo_meterchange].[premisenum] Like "*r",Left([dbo_meterchange].[premisenum],Len([dbo_meterchange].[premisenum])-1),IIf([dbo_meterchange].[premisenum] Like "*l",Left([dbo_meterchange].[premisenum],Len([dbo_meterchange].[premisenum])-1),[dbo_meterchange].[premisenum])+1000000000,9)

    What am I doing wrong here?

    Thank you very much!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,619
    You said if has r or l - so use OR:

    PremiseNum: Right(IIf([dbo_meterchange].[premisenum] Like "*r" OR [dbo_meterchange].[premisenum] Like "*l", Left([dbo_meterchange].[premisenum],Len([dbo_meterchange].[premisenum])-1),[dbo_meterchange].[premisenum])+1000000000,9)
    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.

  3. #3
    dnlhmpt is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Posts
    4
    Quote Originally Posted by June7 View Post
    You said if has r or l - so use OR:

    PremiseNum: Right(IIf([dbo_meterchange].[premisenum] Like "*r" OR [dbo_meterchange].[premisenum] Like "*l", Left([dbo_meterchange].[premisenum],Len([dbo_meterchange].[premisenum])-1),[dbo_meterchange].[premisenum])+1000000000,9)
    Thank you very much! This worked like a charm!

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

Tags for this Thread

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