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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF - not working

Status
Not open for further replies.

fbacchus

IS-IT--Management
May 3, 2001
70
US
I am trying to construct an IIF statement that checks if the Location Name is null then use the district name, but if the district name is null use the location code instead. I have created :

FULLLOCATION: IIf(IsNull([Location Name], [District_Name], IIf(IsNull ([District_Name], [Location_Code],Unk));

I am getting an error on this.

Any help would be appreciated

fb
 
Code:
Location: IIf(Trim([LocationName])<>"",[LocationName],IIf(Trim([DistrictName])<>"",[DistrictName],IIf(Trim([LocationCode])<>"",[LocationCode],"UNKNOWN")))

change the field names to exactly to yours

________________________________________________________
Zameer Abdulla
Help to find Missing people
Even a thief takes ten years to learn his trade.
 
Check parentheses
Code:
FULLLOCATION: IIf(IsNull([Location Name]) AND IsNull([District_Name], Unk,  
IIf(IsNull ([District_Name]), [Location_Code],[District_Name]));

 
And this ?
FULLLOCATION: Nz([Location Name], Nz([District_Name], [Location_Code]));

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

Part and Inventory Search

Sponsor

Back
Top