Hello Experts,
I work for Ecolab and utilize a variety of data and I am starting to manage this data with Access 2007. I have hit a roadbump in my learning around a failing immediate IF statement in a query that someone else wrote that looks like this, that I do not know how to correct:
Jan1: IIf([Stage]="A",IIf([OpenMonth1]=2,1,(IIf([OpenYear1]=11,1,0))),IIf([CloseYear1]<2011,0,IIf([CloseMonth1]<=2,0,1)))
Their goal was to have the value of 1 input for the month of January if the project was started in january of 2011 and remained active. It also must not replace the 1 with a 0 when the project stage changes from active ("A") to closed ("C") at a later date.
So you can then see what this is doing is creating a way to determine the length of time a project was open. Each additional column in the queary reads off of the January line to determine if a 1 or a 0 should go in their respective cells, and then this is all reported via a linked pivot in excel.
I have tried changing the IIf statement around but due to the multiple variables it continually fails, which is what it should be doing from what I now know about IIf statements.
So I want to write this into VBA code. IF elseif code block, but I don't know how to set the variables equal to the other query fields so that the function can pull those values in when it runs.
Can anyone point me in the right direction on this problem? It would be much appreciated.
Thank you.
I work for Ecolab and utilize a variety of data and I am starting to manage this data with Access 2007. I have hit a roadbump in my learning around a failing immediate IF statement in a query that someone else wrote that looks like this, that I do not know how to correct:
Jan1: IIf([Stage]="A",IIf([OpenMonth1]=2,1,(IIf([OpenYear1]=11,1,0))),IIf([CloseYear1]<2011,0,IIf([CloseMonth1]<=2,0,1)))
Their goal was to have the value of 1 input for the month of January if the project was started in january of 2011 and remained active. It also must not replace the 1 with a 0 when the project stage changes from active ("A") to closed ("C") at a later date.
So you can then see what this is doing is creating a way to determine the length of time a project was open. Each additional column in the queary reads off of the January line to determine if a 1 or a 0 should go in their respective cells, and then this is all reported via a linked pivot in excel.
I have tried changing the IIf statement around but due to the multiple variables it continually fails, which is what it should be doing from what I now know about IIf statements.
So I want to write this into VBA code. IF elseif code block, but I don't know how to set the variables equal to the other query fields so that the function can pull those values in when it runs.
Can anyone point me in the right direction on this problem? It would be much appreciated.
Thank you.