Text box with iif and is null statements

  • Thread starter Thread starter srctr
  • Start date Start date
S

srctr

I need to have a text box that combines a couple of fields and text. My
problem is that if the field is blank I need it not to include some of the
text.

The text box is
Dear Alias or FirstName and SpouseName,

What I have is
="Dear " & (IIf(IsNull([Alias]),StrConv([FirstName],3),StrConv([Alias],3)))
& (IIf(IsNull([SpouseName]),StrConv([SpouseName],3))) & ","

Problem is that if there is a spousename it isn't showing. If I add in the
"and" I still don't get the spouse name but I get the and.
I have tried so many combinations, my head is spinning

Help!!
 
srctr,

Your statement says, if there's nothing in SpouseName, show me that...

IIf(IsNull([SpouseName]),StrConv([SpouseName],3))

You need to say...

IIf(Not IsNull([SpouseName]),StrConv([SpouseName],3))

OR forget the IsNull altogether, actually the whole IIf statement as there
is no IIf not this then that...

StrConv([SpouseName],3)

OR ust in case SpouseName is Null

="Dear " & IIf(IsNull([Alias]),StrConv([FirstName],3),StrConv([Alias],3))
& Trim(StrConv([SpouseName],3)) & ","

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm
 
Back
Top