473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Nested IIF Statement not working

I have a database where I have two date fields, Procedure Due Date and Procedure Performed Date. I want to update a checkbox called Procedure over 30 days based on two considerations:

1 - Whenever the Perfomed Date is greated than the Due Date.

2 - Whenever the Due Date has gone by without a Performed date.

I have IIF statements where one situation works, but then wipes out everything that may have been checked by the other situation. I know that I cannot have the two IIF statemnets seperately, but I am having a hard time combining them.

Here are the two statements that I have:

IIf([Procedure Performed Date]>[Procedure Due Date],True,False)

IIf([Procedure Performed Date] Is Null And Date()>[Procedure Due Date],True,False)


I have stared at this so long, my brain hurts! Does anyone have any bright ideas?
Feb 24 '10 #1
2 2491
gershwyn
122 100+
If I'm understanding your requirement correctly (here's hoping!) then this should work:

Expand|Select|Wrap|Line Numbers
  1. IIf(([Procedure Performed Date] Is Null And Date()>[Procedure Due Date]) Or (Nz([Procedure Performed Date],0)>[Procedure Due Date]),True,False)
The Nz function will convert a null value to a zero, which allows us to safely compare it to the due date. That portion of the test will always be false if no Performed Date is given. If either of the two conditions are met, the checkbox will be set to true.

(As an aside, the IIF function isn't strictly necessary. The test conditions will either evaluate to true or false, so you could set the textbox to that value directly. Makes no real difference though, other than slightly less typing.)

Hope that helped.
Gersh
Feb 24 '10 #2
Thanks Gersh! I will try it tomorrow and see if that does the job.
Feb 25 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Tcs | last post by:
My backend is DB2 on our AS/400. While I do HAVE DB2 PE for my PC, I haven't loaded it yet. I'm still using MS Access. And no, I don't believe this is an Access question. (But who knows? I...
2
by: Twan Kennis | last post by:
Question: How do I pass a returning resultset from a nested Stored Procedure (which opens a cursor including option "WITH RETURN TO CALLER") as a returning resultset from it's own? When I...
23
by: Brian | last post by:
Hello All - I am wondering if anyone has any thoughts on which is better from a performance perspective: a nested Select statement or an Inner Join. For example, I could do either of the...
5
by: cbielins | last post by:
I have a problem, and would like you input... I need to evaluate to columns and then base a third column on their values. But, I need to include NULL values and this statement isn't working,...
78
by: Josiah Manson | last post by:
I found that I was repeating the same couple of lines over and over in a function and decided to split those lines into a nested function after copying one too many minor changes all over. The only...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
5
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
Could someone give me a simple example of nested scope in C#, please? I've searched Google for this but have not come up with anything that makes it clear. I am looking at the ECMA guide and...
9
by: notahipee | last post by:
Would someone be able to tell me why this isn't working. The nested for loops seem correctly coded to me. I would appreciate any input. #include <iostream.h> #include <math.h> int main () {...
4
by: Patrick A | last post by:
All, I rely on nested IF statements with multiple conditions heavily, and someone suggested recently writing the statements (and especially reading them months later) would be much easier if I...
7
by: brasse | last post by:
Hello! I have been running in to some problems when using contextlib.nested(). My problem arises when using code similar to this: from __future__ import with_statement from contextlib...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.