Thread: IIf
View Single Post
  #12  
Old March 2nd, 2005, 08:02 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

On Wed, 2 Mar 2005 06:56:00 -0800, "Stephanie"
wrote:

Same #Error

I don't understand this- I have many queries that use:
=Nz([Nickname], [FirstName]) and that expression returns
the correct response.

Now I get it. =Nz([Nickname], [FirstName]) works IF there
is a Nickname (returns Nickname), but if there is no
Nickname it doesn't work (returns #Error).


That's VERY odd, because that's exactly what NZ should do - detect the
case where Nickname is empty!

I think this
is why I ended up using IIf in the first place, but still
can't figure out the IIf syntax to take OldLastName into
considertion.


You need *TWO* IIF statements. The NickName and the OldLastName are
two independent unrelated issues; each must be handled separately.

Try:

IIF([Nickname] & "" = "", [FirstName], [NickName]) & " " &
IIF([OldLastName] & "" = "", [LastName], [OldLastName])


John W. Vinson[MVP]