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 statement help in a query

Status
Not open for further replies.

Legends77

Technical User
Jan 18, 2009
57
US
Below is my current statement:
Gross TimeM: IIf([Product ID]="Scheduled",0,([NetRuntime]+[UnschedDelay])/60)

The problem is that due to someone's mess up I need to admend this for an exception for this month only.

I need to make a statement that has all the following

if [Product ID] = "Scheduled",0,if [Product ID} = "485231" and [Fiscal Year] = 2011 and [MonthID] = "Sept-10" then ([NetRuntime]+16+[UnschedDelay])/60,([NetRuntime]+[UnschedDelay])/60)

I know how to do the "and" in if statements in excel but they don't seem to work the same way in access (which doesn't surprise me).

Any and all help is greatly appreciated and thanks in advance!
 
Looks pretty much right. You just need to use IIF (not IF) and add some parentheses

Code:
IIf ([Product ID] = "Scheduled",
0,
IIf ([Product ID} = "485231" AND [Fiscal Year] = 2011 AND [MonthID] = "Sept-10", 
([NetRuntime]+16+[UnschedDelay])/60,
([NetRuntime]+[UnschedDelay])/60) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top