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  

Nested IIF Statement in a query



 
 
Thread Tools Display Modes
  #1  
Old January 22nd, 2010, 02:34 PM posted to microsoft.public.access.queries
FrankTimJr
external usenet poster
 
Posts: 18
Default Nested IIF Statement in a query

I'm trying to set up a nested IIF statement in a query and I'm striking out.

Basically I'm trying to do the following:

If "Field A" and "Field B" are both blank, "Enter This Text" OR If "Field A"
is NOT blank, "Enter That Text".

Any ideas??
Thanks in adavnce.
Frank
  #2  
Old January 22nd, 2010, 02:53 PM posted to microsoft.public.access.queries
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default Nested IIF Statement in a query

hi Frank,

On 22.01.2010 15:34, FrankTimJr wrote:
I'm trying to set up a nested IIF statement in a query and I'm striking out.

Basically I'm trying to do the following:

If "Field A" and "Field B" are both blank, "Enter This Text" OR If "Field A"
is NOT blank, "Enter That Text".

Iif(Len(Trim(Nz([FieldA], ""))) 0,
"Enter That Text",
Iif(Len(Trim(Nz([FieldB], ""))) = 0), "Enter This Text", "???")

mfG
-- stefan --
  #3  
Old January 22nd, 2010, 02:55 PM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Nested IIF Statement in a query

You haven't indicated what to do if A is blank and B is not.
Assuming you leave the text blank for this column, perhaps something like
this:

IIf([A] Is Null, IIf([b] Is Null, "Enter this text", Null), "Enter that
text")

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"FrankTimJr" wrote in message
...
I'm trying to set up a nested IIF statement in a query and I'm striking
out.

Basically I'm trying to do the following:

If "Field A" and "Field B" are both blank, "Enter This Text" OR If "Field
A"
is NOT blank, "Enter That Text".

Any ideas??
Thanks in adavnce.
Frank


  #4  
Old January 22nd, 2010, 02:56 PM posted to microsoft.public.access.queries
Daryl S[_2_]
external usenet poster
 
Posts: 881
Default Nested IIF Statement in a query

Frank -

You didn't say what the result should be for when A is null and B is not, so
I made something up for that. Here goes:

IIF(isnull([Field A]),iif( isnull([Field B]),"Enter This Text","A null B not
null"),"Enter That Text")

--
Daryl S


"FrankTimJr" wrote:

I'm trying to set up a nested IIF statement in a query and I'm striking out.

Basically I'm trying to do the following:

If "Field A" and "Field B" are both blank, "Enter This Text" OR If "Field A"
is NOT blank, "Enter That Text".

Any ideas??
Thanks in adavnce.
Frank

  #5  
Old January 22nd, 2010, 03:11 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Nested IIF Statement in a query

IIF([FieldA] is Null and [FieldB] is Null,"Both Null"
, IIF([FieldA] is not null,"Field A has a Value",
, IIF([FieldB] is not null,"Field B has a Value",Null)))

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

FrankTimJr wrote:
I'm trying to set up a nested IIF statement in a query and I'm striking out.

Basically I'm trying to do the following:

If "Field A" and "Field B" are both blank, "Enter This Text" OR If "Field A"
is NOT blank, "Enter That Text".

Any ideas??
Thanks in adavnce.
Frank

 




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 08:56 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.