A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Iff statement



 
 
Thread Tools Display Modes
  #1  
Old June 2nd, 2005, 09:20 PM
NCCarol
external usenet poster
 
Posts: n/a
Default 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  
Old June 2nd, 2005, 09:39 PM
fredg
external usenet poster
 
Posts: n/a
Default

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  
Old June 3rd, 2005, 01:07 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default

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.



  #5  
Old December 13th, 2006, 03:56 PM posted to microsoft.public.access.forms
sunshineleo
external usenet poster
 
Posts: 31
Default 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  
Old December 13th, 2006, 04:58 PM posted to microsoft.public.access.forms
sunshineleo
external usenet poster
 
Posts: 31
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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 3rd, 2004 12:10 AM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th, 2004 02: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


All times are GMT +1. The time now is 08:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.