Eljefegeneo
Still trying to learn
- Local time
- Today, 15:56
- Joined
- Jan 10, 2011
- Messages
- 902
I have the following field in a query that is calculated:
The results are exactly what I want. But then I want to omit any 'FALSE' or 0 so I make the citeria -1. Unfortunately it then asks me for the [DPY] and [DPM] values. I also tried 'true' as the criteria with the same result.
The codes for them in the query are:
In my table I have two dates, StartDate which is the original start date of the contract and ContractStarts which is the actual date of the start of the contract. While in 99% of the cases they are the same for new contracts, once in a while they are not. If they are not the same, it shows us that the client has delayed their contract by X number of days. So I want to exclude them. And yes, I need both dates. The else or final -1 (true) condition is for contracts that are renewals, that is, from previous years.
The first part of the first code listed determines if the year is the same for both StartDate and ContractStarts. The second is to determine if the month is the same. If the year is the same and the months are different, the 'false' reading, I don't want them included.
How can use a criteria in this calculated field, SDvCSTF to give me the results I want? Thanks.
Code:
SDvCSTF: IIF([DPY] = -1 and [DPM] = -1, -1, IIF([DPY] = -1 and [DPM] = 0, 0, -1))
The codes for them in the query are:
Code:
DPY: IIF(DatePart("yyyy",[ContractStarts]) = DatePart("yyyy",[StartDate]), -1, 0)
DPM: IIF(DatePart("m",[ContractStarts]) = DatePart("m",[StartDate]), -1, 0)
The first part of the first code listed determines if the year is the same for both StartDate and ContractStarts. The second is to determine if the month is the same. If the year is the same and the months are different, the 'false' reading, I don't want them included.
How can use a criteria in this calculated field, SDvCSTF to give me the results I want? Thanks.