Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

IIF and Nz

Posted on 2015-01-04
6
Medium Priority
?
129 Views
Last Modified: 2015-01-04
Experts, I have a table with a field named [Completed].  This table is an import from Excel.  The field value is either Yes, No or "".    If [Completed] is null or "" then the return should be "No".  

What do you see as wrong in the below statement?  I seem to always get "Yes" for any value in  [Completed] whether it is Yes or "No" or ""

Completed_Group: IIf(Nz([Completed],""=""),"No","Yes")
0
Comment
Question by:pdvsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 40

Accepted Solution

by:
als315 earned 2000 total points
ID: 40530412
Try this code:
IIf(Nz([Completed],"") ="","No",[Completed])
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 40530413
Try
IIf(Nz([Completed], """"), "No", "Yes")

You were trying to set to "No" any thing that was "=". Not sure where you got = from?

Kelvin
0
 
LVL 18

Expert Comment

by:bonjour-aut
ID: 40530422
this should work:
Completed_Group: IIf(Nz([Completed]=""),"No",[Completed])
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 18

Expert Comment

by:bonjour-aut
ID: 40530426
Explanation: Nz([Completed] will give "" in case the field is "" or Null
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40530447
try

Completed_Group: IIf([Completed] & ""="","No", [Completed])

this will give you
No for Null
No for No
Yes for Yes
0
 

Author Closing Comment

by:pdvsa
ID: 40530477
that was it.  thank you.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

598 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question