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!

Change iif statement to ignore nulls?

Status
Not open for further replies.

vbahelp07

Technical User
Oct 16, 2007
115
US
Hi all!
Happy New Year!

i can't figure out how to modify this query so that it will ignore nulls in the Description field?

Expr1: IIf([Description] Like "P/S*","Emplyr Match","401k Ded")

currently it updates ALL the nulls to say 401k Ded but i need to have the Descriptions left blank if there is no value in the first place.

i thought the Nz function but it's not working for me. i get an error msg. most likely my syntax.


Thank you in advance!
 
well is it null or an empty string? maybe:
Code:
Expr1: IIf([Description] Like "P/S*","Emplyr Match", iif([Description] = "", [Description], "401k Ded"))



Leslie

In an open world there's no need for windows and gates
 
Try...

IIf(IsNull([Description]),Null,IIF([Description] Like "P/S*","Emplyr Match","401k Ded"))

I didn't test it but it Should work.

ProDev, Builders of Affordable Software Applications
Visit me at ==>
May God bless you beyond your imagination!!!
 
You mean like:
Code:
IIf(Nz([Description], "") Like "P/S*","Emplyr Match","401k Ded")
??

Alcohol and calculus don't mix, so don't drink and derive.
 
wow everyone!

ok, they all look good. i will test and see which is best and report back :)
 
ok, LonnieJohnson's worked. the others (probably "") is doing the same thing I was originally getting :)


thanks ALL!
 
then that means it really IS Null and not an empty string....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top