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!

IIf function not producing results

Status
Not open for further replies.

THWatson

Technical User
Joined
Apr 25, 2000
Messages
2,601
Location
CA
3 fields in tblMembers are HomeEmail, BusinessEmail, and UseForEmail ... all are text, with "Allow Zero Length" = No.

In a query, I want a column which pulls the one to use. My IIf function is
Code:
E-Mail: IIf([UseForEmail]=[BusinessEmail],[BusinessEmail],[HomeEmail])

The function produces inconsistent results, sometimes showing but other times not. Always showing if both HomeEmail and BusinessEMail have values. In all but 2 cases in the database there is a value in either Home or Business Email.

If I change the function like this
Code:
E-Mail: IIf([UseForEmail]=[HomeEmail],[HomeEmail],[BusinessEmail])
I get more results because there are more members who have a Home E-Mail address.

What do I have to fix in order to produce a value in all but the 2 instances where the member has neither Home nor Business E-mail?

Tom

 
Sorry, I was using the function formula incorrectly. Here's what works...
Code:
email: IIf([UseForEmail]="Home e-mail address",[HomeEmail],[BusinessEmail])

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top