Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with handling a null value 1

Status
Not open for further replies.

bosk00

Technical User
Mar 5, 2004
91
US
I am having trouble with how to handle a null value. In the records their are 2 contact fields. Normally the 2nd one is used. There are cases when there is no second entry. In this case I want to use the first contact. I thought it could be done with an IIf statement, but cannot figure out how to designate the null.
Code:
IIf (QAMAIN.NAME [RED]isnull[/red],QAMAIN.T01NAMC, QAMAIN.NAME) AS NAME
I have tried = null and = " " neither is right. Any help is appreciated.

Thanks

Alan
Senility at its finest
 
Null is not a value, it is a condition.

Think of it as "I don't know"

For more info:
thread181-832106





HTH,
Bob [morning]
 
Thanks Bob, That article did it. I appreciate your help and have a much deserved star.

Alan
Senility at its finest
 
Here is an example of the code.
Code:
 IIf(ISNULL(QAMAIN.NAME), QAMAIN.T01NAMC, QAMAIN.NAME) AS NAME

Alan
Senility at its finest
 
You may also try this:
Nz(QAMAIN.NAME, QAMAIN.T01NAMC) AS NAME


Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top