Solved

Proper syntax for IIF using OR

Posted on 2007-11-27
4
271 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Sorry PuppyDog, your solution didn't work.  Thanks to all for a quick response.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Familiarize people with the process of utilizing SQL Server views 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 Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

763 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

8 Experts available now in Live!

Get 1:1 Help Now