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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

using the IIF



 
 
Thread Tools Display Modes
  #1  
Old March 21st, 2008, 05:09 PM posted to microsoft.public.access.queries
ACSer
external usenet poster
 
Posts: 3
Default using the IIF

i am having trouble with getting the statement to work like i need:

IIf([REFUND_LETTERS_ALL_COUNT].Counter=1,"First Request","Second Request ")
AS Expr1

What I need to do is nest this statement so that the result will show
Counter = 0, blank
Counter= 1, “First Request”
Counter = 2, “Second Request”
Etc….

As of now, it returns "Second Request for all records.
  #2  
Old March 21st, 2008, 05:46 PM posted to microsoft.public.access.queries
fredg
external usenet poster
 
Posts: 4,386
Default using the IIF

On Fri, 21 Mar 2008 10:09:01 -0700, ACSer wrote:

i am having trouble with getting the statement to work like i need:

IIf([REFUND_LETTERS_ALL_COUNT].Counter=1,"First Request","Second Request ")
AS Expr1

What I need to do is nest this statement so that the result will show
Counter = 0, blank
Counter= 1, First Request
Counter = 2, Second Request
EtcK.

As of now, it returns "Second Request for all records.


Here is the syntax to nest iif statements.
IIf(Criteria=A,TrueValueA,IIf(Criteria=B,TrueValue B,FalseValue))

so using your values:

IIf([REFUND_LETTERS_ALL_COUNT].Counter=1,"First Request",
IIf([REFUND_LETTERS_ALL_COUNT].Counter=2,"Second Request,""))
AS Expr1

However I don't like the sound of that Etc... you placed at the end.
If you have a lot of choices there are better functions to use.
Look up Choose(), and Select Case in VBA Help.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #3  
Old March 21st, 2008, 07:07 PM posted to microsoft.public.access.queries
ACSer
external usenet poster
 
Posts: 3
Default using the IIF

i had attempted to use the case statement originally and it bombed...
i used this and with the syntax error corrected, gave me the result needed,
however i am still showing duplicate records for these requests, got any
ideas to stop the duplication?
if the letter

"fredg" wrote:

On Fri, 21 Mar 2008 10:09:01 -0700, ACSer wrote:

i am having trouble with getting the statement to work like i need:

IIf([REFUND_LETTERS_ALL_COUNT].Counter=1,"First Request","Second Request ")
AS Expr1

What I need to do is nest this statement so that the result will show
Counter = 0, blank
Counter= 1, “First Request”
Counter = 2, “Second Request”
Etc….

As of now, it returns "Second Request for all records.


Here is the syntax to nest iif statements.
IIf(Criteria=A,TrueValueA,IIf(Criteria=B,TrueValue B,FalseValue))

so using your values:

IIf([REFUND_LETTERS_ALL_COUNT].Counter=1,"First Request",
IIf([REFUND_LETTERS_ALL_COUNT].Counter=2,"Second Request,""))
AS Expr1

However I don't like the sound of that Etc... you placed at the end.
If you have a lot of choices there are better functions to use.
Look up Choose(), and Select Case in VBA Help.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

  #4  
Old March 21st, 2008, 07:43 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default using the IIF

On Fri, 21 Mar 2008 12:07:03 -0700, ACSer
wrote:

i had attempted to use the case statement originally and it bombed...
i used this and with the syntax error corrected, gave me the result needed,
however i am still showing duplicate records for these requests, got any
ideas to stop the duplication?


Sounds like a different problem with the query; please open the query in SQL
view and post it here. An example of what kind of "duplicate" you're seeing
might help too.
--

John W. Vinson [MVP]
 




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


All times are GMT +1. The time now is 07:24 AM.


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