Jumat, 06 Juli 2018

Re: [MS_AccessPros] Nested IIF statement

 

obviously my example is not right either, because I don't see the logic of what you are doing -- a UDF might be just the ticket to unravel the mess

~crystal


On 7/6/18 1:02 PM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] wrote:

nope -- that is wrong. I see ",2" is for Left.

it might be good to make a user-defined function. Here is a video to do that:

https://www.youtube.com/watch?v=xKx1WHXUqMU

It is not hard to write a custom function, and the code is much easier to get right ;) ~

or maybe just do a few Replaces and skip testing? Be sure the inner replace is the longest value, and so on ... something like this:

Replace(Replace( Replace(
[Temp9] & ""
,"NEW USER'S LOCATION INFO: USA-FRAC-FRA>>", "")
,"NEW USER'S LOCATION INFO: USA-FRA>>", "")
, "NEW USER'S REGION", "")

Perhaps [Temp9] could have a more logical name? I am assuming this is a query and [Temp9] is a fieldname, or calculated field name. Appended "" to it in case it is Null.

have an awesome day,

crystal



On 7/6/18 12:29 PM, crystal 8 strive4peace2008@yahoo.com [MS_Access_Professionals] wrote:

hi Brenda,

it looks like this:

)))),2)

should be this:

),2))))

... or so -- the last IIF needs a False argument -- then all the closing parentheses

have an awesome day,
crystal


On 7/6/18 10:06 AM, hayden_brenda@hotmail.com [MS_Access_Professionals] wrote:

I have looked at this statement too long and still can't figure it out.  I know it's something easy, but I just can't see it.  I get the error statement "The expression you entered has a function containing the wrong number of arguments."

This is my IIF statement:


UserState: Left(Trim(IIf([Temp10] Like "*NEW USER'S REGION*",
  Trim(Replace([Temp10],"NEW USER'S REGION:","")),
IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRA*",
  Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRA>>","")),
IIf([Temp9] Like "*NEW USER'S LOCATION INFO: USA-FRAC-FRA*",
  Replace([Temp9],"NEW USER'S LOCATION INFO: USA-FRAC-FRA>>","")))),2)


Thanks for your help.




__._,_.___

Posted by: crystal 8 <strive4peace2008@yahoo.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


SPONSORED LINKS
.

__,_._,___

Tidak ada komentar:

Posting Komentar