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

Text box with iif and is null statements



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2009, 08:21 PM posted to microsoft.public.access.reports
srctr
external usenet poster
 
Posts: 56
Default Text box with iif and is null statements

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!!
  #2  
Old December 2nd, 2009, 08:41 PM posted to microsoft.public.access.reports
Gina Whipp
external usenet poster
 
Posts: 3,500
Default Text box with iif and is null statements

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

"srctr" wrote in message
...
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!!



  #3  
Old December 2nd, 2009, 08:44 PM posted to microsoft.public.access.reports
Gina Whipp
external usenet poster
 
Posts: 3,500
Default Text box with iif and is null statements

Just realized I forgot the " and "... After the first ampersand place...
" and " &

--
Gina Whipp

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

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

"srctr" wrote in message
...
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!!



 




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 03:36 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.