Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Reports / Printing / December 2005

Tip: Looking for answers? Try searching our database.

Get an iif statemnt to search for a null value?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Julianne - 14 Dec 2005 20:48 GMT
You all have been so wonderful and extremely helpful.  May I borrow upon your
expertise again?  In a report I would like to create a text box that checks
to see if a field has a null value.  I've been using the Iif function but am
at a loss as how to ask it to "check to see if the field is blank.  If it is,
return the word "problem."  Thank you again and again for sharing your
knowledge.  Happy Holidays and a joyous New Year.
George Nicholson - 14 Dec 2005 21:14 GMT
Null never "equals" anything, so Anything = Null will always return False.

Paraphrasing Yoda: "Null Is, or Is Not. There is no 'equal'."

ahem.

Try:
= iif(IsNull([MyField], "Problem", [MyField])

or, use Access' (not VB's) nz (NullToZero) function to achieve the same
thing with less typing:
= nz([MyField],"Problem")

HTH,
Signature

George Nicholson

Remove 'Junk' from return address.

> You all have been so wonderful and extremely helpful.  May I borrow upon
> your
[quoted text clipped - 6 lines]
> return the word "problem."  Thank you again and again for sharing your
> knowledge.  Happy Holidays and a joyous New Year.
Marshall Barton - 14 Dec 2005 21:25 GMT
>In a report I would like to create a text box that checks
>to see if a field has a null value.  I've been using the Iif function but am
>at a loss as how to ask it to "check to see if the field is blank.  If it is,
>return the word "problem."

A text box expression could use:
    =Nz(thefield, "Problem")

Or, in more complex situations:
    =IIf(thefield Is Null, "Problem", something else)

OTOH, in a VBA statement you would use:
    ... IIf(IsNull(thefield), "Problem", something else) ...

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.