Solved

Proper syntax for IIF using OR

Posted on 2007-11-27
4
309 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
[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
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 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) 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

Technology Partners: 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!

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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 …

740 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