Here is the code I am currently working with:
Days Worked: IIf([Employee Basic Info]![Status]="A" Or "L",IIf([Emp Date]![Term Date]<>""),DateDiff("d",[Emp Date]![Rehire Date],"5/31/2011"),DateDiff("d",[Emp Date]![Hire Date],"05/31/2011")))
I have tested each item individually, but once I put them together, the whole thing blows up. The answers for everything are correct except the DateDiff Rehire Date portion just after the second IIf statement. Those are coming back as #error. Myself and our Access person have narrowed it down to the IIf statement. I have tried using a null statement, have tried the <>"" and we have even started trying the IsEmpty and IsMissing statements. Nothing seems to be working for me. The general idea here is that I have a couple colomns of dates for my employees - a hire date a term date and a rehire date. I want to count the number of days between the hire date and a given date (05/31/2011) in this case UNLESS they have been termed and then rehired. If they were termed and rehired, then I need to count the difference in days between the rehired date and the given date (05/31/2011). I am in Access 2007. Any help is greatly appreciated as always.
Days Worked: IIf([Employee Basic Info]![Status]="A" Or "L",IIf([Emp Date]![Term Date]<>""),DateDiff("d",[Emp Date]![Rehire Date],"5/31/2011"),DateDiff("d",[Emp Date]![Hire Date],"05/31/2011")))
I have tested each item individually, but once I put them together, the whole thing blows up. The answers for everything are correct except the DateDiff Rehire Date portion just after the second IIf statement. Those are coming back as #error. Myself and our Access person have narrowed it down to the IIf statement. I have tried using a null statement, have tried the <>"" and we have even started trying the IsEmpty and IsMissing statements. Nothing seems to be working for me. The general idea here is that I have a couple colomns of dates for my employees - a hire date a term date and a rehire date. I want to count the number of days between the hire date and a given date (05/31/2011) in this case UNLESS they have been termed and then rehired. If they were termed and rehired, then I need to count the difference in days between the rehired date and the given date (05/31/2011). I am in Access 2007. Any help is greatly appreciated as always.