Kamis, 30 Oktober 2014

RE: [MS_AccessPros] IIF evaluating part of a text phrase

 

Jeff's statement should work as expected.
 
The IIf() function should contain three arguments:
  IIf( [Condition to Evaluate], [Return if True], [Return if False])
 
I will sometimes set the third argument to Null.
 
Duane Hookom MVP
MS Access
 

From: MS_Access_Professionals@yahoogroups.com
Karen,
 
Why not try IIF(instr(LOB, "FHN") > 0, ....)
 
Jeff




From: "k2j1203@yahoo.com [MS_Access_Professionals]" MS_Access_Professionals@yahoogroups.com 

Hello everyone.


I just have a quick question.  I feel like I should know the answer to this but I'm drawing a blank.  All that I want to do is use IIF to find a value and if true insert a text phrase.  Easy enough.  However, the twist.  I want to be able to evaluate a field value that contains my text as part of the field value.  In case I didn't explain my self correctly, here's an example.


The field [LOB} contains the value "FHN/ACA, ICP only".  I want to evaluate this information to see if "FHN" is a part of the value.  Then I want Access to return the value "FHN" if it is part of the text.  I've tried two different ways to write the function.


IIF([LOB] Like "*FHN*", "FHN")
IIF([LOB] = "*FHN*", "FHN")


They both come back as blank when I run them.  Can someone tell me what I'm doing wrong?  I seem to be having a "brain fart."


Thanks.
Karen
 

__._,_.___

Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___

Tidak ada komentar:

Posting Komentar