If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Iff statement
I would like to use an if statement to display text, dependent on data in
field. for example ; If [field] = "C", then display "completed", or if [field] is = "D" then display "Do over", or if [field] = "M" then display "Move". I thought I could make it work with an IIF statement, but I cannot seem to get it right. Any help would be appreciated. |
#2
|
|||
|
|||
On Thu, 2 Jun 2005 13:20:03 -0700, NCCarol wrote:
I would like to use an if statement to display text, dependent on data in field. for example ; If [field] = "C", then display "completed", or if [field] is = "D" then display "Do over", or if [field] = "M" then display "Move". I thought I could make it work with an IIF statement, but I cannot seem to get it right. Any help would be appreciated. =IIf([FieldA] = "C","Completed",IIf([FieldA]="D",Do Over","Move")) The above assumes there are just the 3 choices, C,D,or M, and it will always have an entry. If there is a possibility that no value will be entered, then use: =IIf([FieldA] = "C","Completed",IIf([FieldA]="D","Do Over", IIf([FieldA] = "M","Move","No Entry"))) -- Fred Please only reply to this newsgroup. I do not reply to personal email. |
#3
|
|||
|
|||
For 3 or more alternatives, I prefer to use the Switch() function (for 2
alternatives the IIf() function). Something like: = Switch([Field1] = "C", "Completed", [Field1] = "D", "Do Over", [Field1] = "M", "Move") -- HTH Van T. Dinh MVP (Access) "NCCarol" wrote in message news I would like to use an if statement to display text, dependent on data in field. for example ; If [field] = "C", then display "completed", or if [field] is = "D" then display "Do over", or if [field] = "M" then display "Move". I thought I could make it work with an IIF statement, but I cannot seem to get it right. Any help would be appreciated. |
#4
|
|||
|
|||
It would be more efficient to use a Case Statement.
Allan Murphy Email: "NCCarol" wrote in message news I would like to use an if statement to display text, dependent on data in field. for example ; If [field] = "C", then display "completed", or if [field] is = "D" then display "Do over", or if [field] = "M" then display "Move". I thought I could make it work with an IIF statement, but I cannot seem to get it right. Any help would be appreciated. |
#5
|
|||
|
|||
Iff statement
How would you write the code for calculating?
IIf([txt_CumulAmt2] ".50", "Completed",IIf(cbo_mmt100] ".50","Do Over" then Add [txt_CumulAmt2]+[txtcumulamt1] )) I know this is not correct... but am I on the right track? Thanks! "Allan Murphy" wrote: It would be more efficient to use a Case Statement. Allan Murphy Email: "NCCarol" wrote in message news I would like to use an if statement to display text, dependent on data in field. for example ; If [field] = "C", then display "completed", or if [field] is = "D" then display "Do over", or if [field] = "M" then display "Move". I thought I could make it work with an IIF statement, but I cannot seem to get it right. Any help would be appreciated. |
#6
|
|||
|
|||
Iff statement
And, where does this code go? It doesn't work in the Control Source.
Thanks. "sunshineleo" wrote: How would you write the code for calculating? IIf([txt_CumulAmt2] ".50", "Completed",IIf(cbo_mmt100] ".50","Do Over" then Add [txt_CumulAmt2]+[txtcumulamt1] )) I know this is not correct... but am I on the right track? Thanks! "Allan Murphy" wrote: It would be more efficient to use a Case Statement. Allan Murphy Email: "NCCarol" wrote in message news I would like to use an if statement to display text, dependent on data in field. for example ; If [field] = "C", then display "completed", or if [field] is = "D" then display "Do over", or if [field] = "M" then display "Move". I thought I could make it work with an IIF statement, but I cannot seem to get it right. Any help would be appreciated. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Do I need a sumif or sum of a vlookup formula? | PeterB | Worksheet Functions | 0 | June 1st, 2005 12:23 PM |
Stop Statement Doesn't Stop | drwip | General Discussion | 1 | December 2nd, 2004 11:10 PM |
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements | Mark V | Mailmerge | 8 | November 30th, 2004 01:31 PM |
using the results of a SQL SELECT(COUNT) statement in VBA | Paul James | Running & Setting Up Queries | 7 | September 24th, 2004 09:44 PM |
Access 2000 query SQL statement into VBA code | Clint | Running & Setting Up Queries | 1 | June 10th, 2004 01:33 PM |