iif statement

unclefink

Registered User.
Local time
Today, 02:44
Joined
May 7, 2012
Messages
184
I'm trying to build a query with an iif statement to calculate expiration dates within a query. For some reason what i'm trying to do is not working as expected.

Here's the situation. Every employees with an exception of two employees in the company has an expiration 2 years after the class took place. The two exceptions are the certified instructors who's training certification is good for three years.

I've created a query with the employeeid, training subject, and maxoftraining date.

I'm trying to write an if statement to give me the expiration date based on the above information. Here's what I have so far; however its not calculating based on the criteria.

Expiration: IIf([tblemployee]![EmpID]=1 Or 2,DateAdd("yyyy",3,[maxoftrainingdate]),DateAdd("yyyy",2,[maxoftrainingdate]))

At this point in time, all "expiration" dates are showing + 3 years rather than just the Employee ID's 1 and 2 and the rest +2 years.

Thanks in advance.

David
 
Code:
IIf([tblemployee]![EmpID]=1 Or [tblemployee]![EmpID]=2 .....
or

Code:
IIf([tblemployee]![EmpID] IN(1,2)...
 
Last edited:
Thank you very much Galaxiom, I tried all sort of variations in attempt to get the result I was looking for and for some reason, thats the one thing I didnt think of. At least I was close.

Thanks again for the help, your prompt response was much appreciated, i've been brainstorming this over the last couple days and it was starting to drive me nutso.

Respectfully,

David. :banghead:
 

Users who are viewing this thread

Back
Top Bottom