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

If, then statement Problem

Status
Not open for further replies.

cjany

IS-IT--Management
Nov 3, 2004
72
US
I'm having trouble with this code:

contact: IIf(IsNull([COMPOFCR] Or [COMPOFCR]="ZZZ"),"Compliance Section at 555-5555",[First Name] & " " & [Last Name] & " at 555-5555 ext " & [Extension])

The COMPOFCR field could either be null, "ZZZ" or an officers code. If it's null or "ZZZ" then the contact needs to be Compliance Section or else the officer's name and extension. This code works for the null values, but for the "ZZZ" values I get this returned: "at 555-5555 ext"

Any suggestions?
 
contact: IIf(IsNull([COMPOFCR]) Or [COMPOFCR]="ZZZ","Compliance Section at 555-5555",[First Name] & " " & [Last Name] & " at 555-5555 ext " & [Extension])

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual

Essential reading for anyone working with databases: The Fundamentals of Relational Database Design
 
That worked. Parenthesis make all the difference. Thank you.

cjany
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top