?
Solved

IIF and Nz

Posted on 2015-01-04
6
Medium Priority
?
128 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

762 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