473,395 Members | 2,192 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,395 software developers and data experts.

My Nested IIf statement using DateAdd function doesn't work!

Hi All,

I'm trying to produce 3 outcomes in one field using the DateAdd function but I can't get it to work.

This is what I want to happen :

If Field A = "Medical", DateAdd('yyyy',1,(DateAdd('m',3,[Field B] (I CAN GET THIS PART TO WORK FINE)

If Field A = "Yes", DateAdd('yyyy',1,[Field B] (I CAN GET THIS TO WORK FINE BUT NOT WHEN I NEST IT WITH THE ABOVE!)

Third scenario is ELSE "N/A"

This is what I thought would work :

Next Review Date : IIf([Field A] = "Medical",(DateAdd('yyyy',1,(DateAdd('m',3,[Field B],IIf([Field A] = "Yes", (DateAdd('yyyy',1,[Field B],"N/A")))))

Regards

Darren
Jan 29 '15 #1
1 1157
twinnyfo
3,653 Expert Mod 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1. IIf([Field A] = "Medical", _
  2.     (DateAdd("yyyy", 1, (DateAdd("m", 3, [Field B])), _
  3.     IIf([Field A] = "Yes", _
  4.         DateAdd("yyyy", 1, [Field B]), _
  5.         "N/A"))))
Jan 29 '15 #2

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

Similar topics

2
by: Abdul N K | last post by:
I need help in T-SQL. I am using DATEADD function and I want to add 6 months to a date. But it does not return me the rusults, which I want e.g. SELECT DATEADD(m,'20040630') returns 20041230...
4
by: ey.markov | last post by:
Greetings, I have an A2K application where for a report the user enters a month-end date, and the system must gather transactions for that month. No problem, I thought, I'll just use the DateAdd...
4
by: David | last post by:
The statement works fine when I use it in Access, but when I use it from VB, I get the error "Undefined function 'Nz' in expression." Could anyone please explain how to correct this? Thank you.
2
by: Rich Raffenetti | last post by:
I have the following code. If I do the dateadd function with dateinterval.minute, it works fine and the date/time value is displayed with zero seconds. If I do the dateadd function with...
1
by: Hugo Flores | last post by:
Hello I have this code in actionscript that calls javascript: actionscript: zoom_in = function () { var tw1:Tween = new Tween(mc_1, "_width", Regular.easeOut, mc_1._width, 0, 1, false);...
12
by: effendi | last post by:
I wrote the following function and tested it in MSIE, Firefox and Mac Safari, Works in all but the Safari. What can I do to rectify this? function processBackground(){ for (n=1;n<11;n++) { ...
2
by: effendi | last post by:
Hi I tested the following function in Safari and it doesnt work. This is tested fine in IE. function processOutcome(){ mainDatabase=document.forms.AssessDatabase.value var...
2
by: tanichka | last post by:
Hello you helpful folk! Please look at my script and tell me what I am doing wrong! I am cleaning the names of my music files from unnecessary symbols, and the cleaning works fine, however the perl...
9
by: lisa007 | last post by:
I'm trying to use a function that will be if A nill then B and C get a value and vice verse if B nill C and A have value and the all function meant to be called right at the top of the drop down list...
6
by: metronj | last post by:
Hello All, Recently I was asked to make some changes to some business logic for a report generator I created for our office. Basically what I'm trying to do is this: 1)Evaluate a Date Field...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.