1st of The Month

G

Guest

Hi
Here is the scenerio:

I want to run a query which will me a list of all employees eligible for
401-K enrollment as of last pay period. The criteria for eligibility is as
follows:

If an employee's hiredate is the 1st of the Month, then he/she is eligible
on the 1st day of the 3rd calender month after the hire date.

Example: If hire date = 07/01/06, then Eligibility date = 10/1/06

If an employee's hiredate is not the first of the Month, then he/she is
eligible on the 1st day of the 4th calender month after the hire date.

Example: If hire date = 07/02/06, then Eligibility date = 11/1/06


Can someone tell me how to build this query?

Thank you in advance for your help.

Yasser
 
G

Guest

Try this --
SELECT YasserEMP.EmpID, YasserEMP.HireDate,
IIf([HireDate]<=[HireDate]-Day([HireDate])+1,DateAdd("m",3,[HireDate]-Day([HireDate])+1),DateAdd("m",4,[HireDate]-Day([HireDate])+1))
AS [401K Eligibility date]
FROM YasserEMP;
 
G

Guest

Karl
Your query worked like magic!

Thanks again

KARL DEWEY said:
Try this --
SELECT YasserEMP.EmpID, YasserEMP.HireDate,
IIf([HireDate]<=[HireDate]-Day([HireDate])+1,DateAdd("m",3,[HireDate]-Day([HireDate])+1),DateAdd("m",4,[HireDate]-Day([HireDate])+1))
AS [401K Eligibility date]
FROM YasserEMP;


yasser said:
Hi
Here is the scenerio:

I want to run a query which will me a list of all employees eligible for
401-K enrollment as of last pay period. The criteria for eligibility is as
follows:

If an employee's hiredate is the 1st of the Month, then he/she is eligible
on the 1st day of the 3rd calender month after the hire date.

Example: If hire date = 07/01/06, then Eligibility date = 10/1/06

If an employee's hiredate is not the first of the Month, then he/she is
eligible on the 1st day of the 4th calender month after the hire date.

Example: If hire date = 07/02/06, then Eligibility date = 11/1/06


Can someone tell me how to build this query?

Thank you in advance for your help.

Yasser
 

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