Hello I am using Access 2002 on a WinXp PC. I have the following in a query.
Count_E_Months: IIf([CEYear]=Format(Date(),"yyyy"),DateDiff("m",[Contract Effective Date],DateAdd("m",1,"1 " & Format$(Date(),"mmmm yyyy"))),0)
Count_R_Months: IIf([RYear]>Format(Date(),"yyyy"),Abs(DateDiff("m",[Renewal Date],DateAdd("m",1,"1 " & Format$(Date(),"mmmm yyyy")))),0)
I need to find the number of months a contract was effective in each month. eg. Date in CEYear = 2005 Date in contract Effective Date 10/01/2005. This will give me 3 for Count_E_Months.
I also need to know the number of months a contract will be effective the next year. Eg Date in RYear = 2006 Date in Renewal Date 10/01/2005. This will give Count_R_Months = 10.
These queries work as long as my Date() and the Contract Effective are in the same year. I have some Contract Effective Dates that are 2004 and Renewed in 2005. I can't seem to get that to work. Even if I need another coloumn or a new query. 10/01/2004 = 15 (12 +3) I tried to create a new query and filter only for current year - 1 to get only 2004 data, but I seem to be unsuccessfull with that. I feel like an idiot. I tried format(Date(),"yyyy") -1 Date() - 365 My query returns no result. I would appreciate any guidance.
thanks
Count_E_Months: IIf([CEYear]=Format(Date(),"yyyy"),DateDiff("m",[Contract Effective Date],DateAdd("m",1,"1 " & Format$(Date(),"mmmm yyyy"))),0)
Count_R_Months: IIf([RYear]>Format(Date(),"yyyy"),Abs(DateDiff("m",[Renewal Date],DateAdd("m",1,"1 " & Format$(Date(),"mmmm yyyy")))),0)
I need to find the number of months a contract was effective in each month. eg. Date in CEYear = 2005 Date in contract Effective Date 10/01/2005. This will give me 3 for Count_E_Months.
I also need to know the number of months a contract will be effective the next year. Eg Date in RYear = 2006 Date in Renewal Date 10/01/2005. This will give Count_R_Months = 10.
These queries work as long as my Date() and the Contract Effective are in the same year. I have some Contract Effective Dates that are 2004 and Renewed in 2005. I can't seem to get that to work. Even if I need another coloumn or a new query. 10/01/2004 = 15 (12 +3) I tried to create a new query and filter only for current year - 1 to get only 2004 data, but I seem to be unsuccessfull with that. I feel like an idiot. I tried format(Date(),"yyyy") -1 Date() - 365 My query returns no result. I would appreciate any guidance.
thanks