I need to calulate hours logged on a semi-annual basis based on a persons birth month. For example employee Jim has a birth month of October. I need to calulate his hours logged from Nov to Apr (1st Semi) and again from Apr to Nov (2nd Semi). It needs to be done on a adhoc basis through out the year so if its Dec 25th I would get his 1st semi annual total from Nov 1 to Dec 25th and nothing for his 2nd becuase there is nothing logged in the period.
I have tried a between statement where HoursLogged >DateAdd(M,1,BirthMonth) and <=DateAdd(M,6,BirthMonth).
Doesnt work becuase if his birth year is 1975 it fails. It adds the months correctly it just adds with year 1975 not current year.
If I parse out the date to a numeric value as in this case I get 10. If you add 6 to it you get 16 not 4 which would be April. The birth year doesnt matter only the current year and previous year in most cases.
I am looking to do this either in a query or if need be VBA to calculate it. It all makes sense in my head and 10 years ago I might have had an easier time with it
Ideas please. Thanks again.
Remember the Past, Plan for the Future, yet Live in the Present for tomorrow may never come.
-etrain
I have tried a between statement where HoursLogged >DateAdd(M,1,BirthMonth) and <=DateAdd(M,6,BirthMonth).
Doesnt work becuase if his birth year is 1975 it fails. It adds the months correctly it just adds with year 1975 not current year.
If I parse out the date to a numeric value as in this case I get 10. If you add 6 to it you get 16 not 4 which would be April. The birth year doesnt matter only the current year and previous year in most cases.
I am looking to do this either in a query or if need be VBA to calculate it. It all makes sense in my head and 10 years ago I might have had an easier time with it
Ideas please. Thanks again.
Remember the Past, Plan for the Future, yet Live in the Present for tomorrow may never come.
-etrain