Solved

Proper syntax for IIF using OR

Posted on 2007-11-27
4
294 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 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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 …

832 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