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

Nested IIf Function Syntax 1

Status
Not open for further replies.

Valeriya

MIS
Jan 9, 2006
138
US
I'm stack with syntax, trying to write a nested IIf function with an omitted false part.Can anybody tell me what actually I'm doing wrong:

IIf ([0505 Q TotalDaysDiscrepantNoComment].[Datediff_1] < [0506 Q TotalDaysDiscrepantWComment].[DateDiff_2],"True Returned/Implanted"),
IIf ([0505 Q TotalDaysDiscrepantNoComment]. [Datediff_1] > [0506 Q TotalDaysDiscrepantWComment]. [DateDiff_2]),"Was counted After it was Returned/Implanted"),
IIf ([0505 Q TotalDaysDiscrepantNoComment]. [Datediff_1] = [0506 Q TotalDaysDiscrepantWComment]. [DateDiff_2]),"Research")


Thank you in advance!

Valeriya
 
IIf ([0505 Q TotalDaysDiscrepantNoComment].[Datediff_1] < [0506 Q TotalDaysDiscrepantWComment].[DateDiff_2], "True Returned/Implanted",
IIf ([0505 Q TotalDaysDiscrepantNoComment].[Datediff_1] > [0506 Q TotalDaysDiscrepantWComment].[DateDiff_2], "Was counted After it was Returned/Implanted",
"Research"))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I appriciate your help, but now it started asking me to enter a parametr value...Any other thoughts?
Thanks a Lot!
 
Double check the table and field names ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I double checked the table and field names, everything is absoultly correct...
Thanks,
 
SELECT [0505 Q TotalDaysDiscrepantNoComment].TID AS TID_1, [0505 Q TotalDaysDiscrepantNoComment].DateDifference AS DateDiff_1, [0505 Q TotalDaysDiscrepantNoComment].Comment AS Comment1, [0506 Q TotalDaysDiscrepantWComment].TID AS TID_2, [0506 Q TotalDaysDiscrepantWComment].DateDifference AS DateDiff_2, [0506 Q TotalDaysDiscrepantWComment].Comment AS Comment2, IIf([0505 Q TotalDaysDiscrepantNoComment].[DateDiff_1]<[
0506 Q TotalDaysDiscrepantWComment].[DateDiff_2],"True Returned/Implanted",IIf([0505 Q TotalDaysDiscrepantNoComment].[DateDiff_1]>[
0506 Q TotalDaysDiscrepantWComment].[DateDiff_2],"Was counted After it was Returned/Implanted","Research")) AS Expr1
FROM [0505 Q TotalDaysDiscrepantNoComment] INNER JOIN [0506 Q TotalDaysDiscrepantWComment] ON [0505 Q TotalDaysDiscrepantNoComment].TID = [0506 Q TotalDaysDiscrepantWComment].TID
GROUP BY [0505 Q TotalDaysDiscrepantNoComment].TID, [0505 Q TotalDaysDiscrepantNoComment].DateDifference, [0505 Q TotalDaysDiscrepantNoComment].Comment, [0506 Q TotalDaysDiscrepantWComment].TID, [0506 Q TotalDaysDiscrepantWComment].DateDifference, [0506 Q TotalDaysDiscrepantWComment].Comment;

 
Try either this:
IIf([0505 Q TotalDaysDiscrepantNoComment].[DateDifference]<[0506 Q TotalDaysDiscrepantWComment].[DateDifference],"True Returned/Implanted",IIf([0505 Q TotalDaysDiscrepantNoComment].[DateDifference]>[0506 Q TotalDaysDiscrepantWComment].[DateDifference],"Was counted After it was Returned/Implanted","Research")) AS Expr1
Or this:
IIf(DateDiff_1<DateDiff_2,"True Returned/Implanted",IIf(DateDiff_1>DateDiff_2,"Was counted After it was Returned/Implanted","Research")) AS Expr1

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'm greatly appriciate your help PHV!
Thanks a lot lespaul!
It starting calculating something,yet the result is not absolutelly correct, but I'll figure out by myself, the hardest part is done already:)))
Good night Guys!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top