Solved

Proper syntax for IIF using OR

Posted on 2007-11-27
4
284 Views
Last Modified: 2012-08-14
If have the following formula in a text box:

=IIf(DateAdd("yyyy",1,[LastApmnt])<Date() And (Not IsNull([ContactType]) And ([ContactType]<>"None" Or [ContactType]<>"Trials")),"EXPIRED","")

I am trying to check if a date from [LastApmnt] is more than a year old and if so put up EXPIRED only when [ContactType] is not null and not equal to None or Trials.  

I can get a formula working  when only checking for trials or none but not both.  What am I doing wrong?

0
Comment
Question by:thandel
4 Comments
 
LVL 14

Accepted Solution

by:
bluelizard earned 125 total points
ID: 20358897
i suggest this expression:

=IIf( DateAdd("yyyy",1,[LastApmnt])<Date(), IIf( IsNull([ContactType]), "", IIf( [ContactType]="None" OR [ContactType]="Trials", "", "EXPIRED" ) ) , "")


--bluelizard

0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 125 total points
ID: 20358961
try

= IIf((DateAdd("yyyy",1,[LastApmnt])<Date() And (Not IsNull([ContactType])) And ([ContactType]<>"None" And [ContactType]<>"Trials")),"EXPIRED","")
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 20359038
try this:
=IIf(DateAdd("yyyy",1,[LastApmnt])<Date() And Not IsNull([ContactType]) And ([ContactType]<>"None" Or [ContactType]<>"Trials"),"EXPIRED","")
0
 

Author Closing Comment

by:thandel
ID: 31411207
Sorry PuppyDog, your solution didn't work.  Thanks to all for a quick response.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now