Double Iif Statements

J

Joanne

Hello,
In a query I am trying to enter the number of days a person has taken for a
particular vacation request, and I need to somehow determine 1/2 days, so if
the begin date and end date of the vacation are the same, I am entering .5.
If an employee wants a full day, they will have to enter the end data as the
next day. If the "type of day" is "Personal", "Jury Duty", or "Carryover", I
want Access to enter a "0". I set up a double Iif but if I try to add a
comma and a "0" it tells me I have too many arguments. So I'm not sure how
to proceed. Thank you very much for your help.
______________________________________
TotalVacation: IIf([Type Of Day] In ("Personal","Jury Duty","Carryover") And
[OLP Begin Date]=[OLP End Date],.5,IIf([Type Of Day] In ("Personal","Jury
Duty","Carryover") And [OLP Begin Date]<>[OLP End Date],DateDiff("d",[OLP
Begin Date],[OLP End Date]),0)
 
B

Beetle

IIf([Type Of Day] In("Personal", "Jury Duty", "Carryover"), 0,
IIf(DateDiff("d", [OLP Begin Date], [OLP End Date])=0, .5,
DateDiff("d", [OLP Begin Date], [OLP End Date])))
 
J

Joanne

I tip my hat to you.

Beetle said:
IIf([Type Of Day] In("Personal", "Jury Duty", "Carryover"), 0,
IIf(DateDiff("d", [OLP Begin Date], [OLP End Date])=0, .5,
DateDiff("d", [OLP Begin Date], [OLP End Date])))
--
_________

Sean Bailey


Joanne said:
Hello,
In a query I am trying to enter the number of days a person has taken for a
particular vacation request, and I need to somehow determine 1/2 days, so if
the begin date and end date of the vacation are the same, I am entering .5.
If an employee wants a full day, they will have to enter the end data as the
next day. If the "type of day" is "Personal", "Jury Duty", or "Carryover", I
want Access to enter a "0". I set up a double Iif but if I try to add a
comma and a "0" it tells me I have too many arguments. So I'm not sure how
to proceed. Thank you very much for your help.
______________________________________
TotalVacation: IIf([Type Of Day] In ("Personal","Jury Duty","Carryover") And
[OLP Begin Date]=[OLP End Date],.5,IIf([Type Of Day] In ("Personal","Jury
Duty","Carryover") And [OLP Begin Date]<>[OLP End Date],DateDiff("d",[OLP
Begin Date],[OLP End Date]),0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top