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

Multiple or nested IIF condition

Status
Not open for further replies.

varadha72

Programmer
Oct 14, 2010
82
US
Hi Folks I need some help here.

IIf( Price.[FileName] ="Price" and [SubmissionType]="Add", "467",
IIf( Price.[FileName] ="Price" and [SubmissionType]="Change", "467",
IIf( Price.[FileName] ="Rate" and [SubmissionType]="Add", "209",
IIf( Price.[FileName] ="Rate" and [SubmissionType]="Change", "TA","")))) AS TACheck_label

This query is throwing error. Can someone help me here please.
 

Could it be something as simple as an extra SPACE?
Code:
IIf([[highlight #FCE94F] [/highlight]Price


Randy
 
I abhor nested IIf()s. These values and numbers should be stored in a table where your data belongs. However consider using Switch()

Code:
Switch(Price.[FileName] ="Price" and [SubmissionType]="Add", "467", 
  Price.[FileName] ="Price" and [SubmissionType]="Change", "467",
  Price.[FileName] ="Rate" and [SubmissionType]="Add", "209",
  Price.[FileName] ="Rate" and [SubmissionType]="Change", "TA",
  True, "")

Do you really want to return a string from the expression?

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top