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!

Need help with IIf statement

Status
Not open for further replies.

JackieEVSC

Programmer
Oct 27, 2011
8
US
I have a query that pulls in info for student netbooks. One model of netbooks has some units that are not under warranty. I am having trouble getting this query to work as needed. I know it's some silly syntax issue I can't see.

The query returns results for all assets with one of 6 AssetTypeID's. Only one of those asset types have warranty issues (227754). I need the IIF statement to return 'THIS UNIT IS NOT UNDER WARRANTY' if the AssetTypeID is 227754 and the InsSvcTag field is empty. The statement below gives me '#ERROR' on the ones that fit the criteria. What am I doing wrong?

Warranty: IIf([62-StudentWarranty]![AssetTypeID]=227754&[62-StudentWarranty]![InsSvcTag]=Null,"THIS UNIT IS NOT UNDER WARRANTY","")
 
Oops ... if the AssetTypeID is 227754 and the InsSvcTag field is empty I get #Error ... if the AssetTypeID is 227754 and the InsSvcTag field is empty I get nothing
 
Warranty: IIf([62-StudentWarranty]![AssetTypeID]=227754 And Trim([62-StudentWarranty]![InsSvcTag] & "")="","THIS UNIT IS NOT UNDER WARRANTY","")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top