I am trying to figure out an expression to calculate vacation time for our employees.
Employees get 40 hours after 1 year
They get 80 hours as of Jan. 1 after that year
They get 120 hours after 10 years.
So, if an employee is hired on Dec, 15, 2003 then as of Dec. 15, 2004 he will have 40 hours but then 2 weeks later as of Jan 1, he will get 80.
I have NO idea how to do this. I have some calculations in text boxes on reports but I'l like to add this one to a query and don't think that the IIF code will work there.
I came up with something like this but I KNOW it isn't right, especially when it comes to the January thing.
IIF Month(DateToday)-[HireDate]>365, 0, IIF Month(DateToday)-[HireDate]>365, 40, IIF Month(DateToday)-[HireDate]>365 AND >Month(January 1), 80, IIF Month(DateToday)-[HireDate]>3650, 120
Do you use IIF in a query? Is there a good book with references to this sort of thing in it?
Can anyone help? Thanks so much!
Employees get 40 hours after 1 year
They get 80 hours as of Jan. 1 after that year
They get 120 hours after 10 years.
So, if an employee is hired on Dec, 15, 2003 then as of Dec. 15, 2004 he will have 40 hours but then 2 weeks later as of Jan 1, he will get 80.
I have NO idea how to do this. I have some calculations in text boxes on reports but I'l like to add this one to a query and don't think that the IIF code will work there.
I came up with something like this but I KNOW it isn't right, especially when it comes to the January thing.
IIF Month(DateToday)-[HireDate]>365, 0, IIF Month(DateToday)-[HireDate]>365, 40, IIF Month(DateToday)-[HireDate]>365 AND >Month(January 1), 80, IIF Month(DateToday)-[HireDate]>3650, 120
Do you use IIF in a query? Is there a good book with references to this sort of thing in it?
Can anyone help? Thanks so much!