Solved

Proper syntax for IIF using OR

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

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.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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 “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…

839 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