>I have the following function in place but it doesn't seem to be working in all cases. The function is supposed to return the Students effective primary insurance at the time of a therapy transaction. The business rules in place are only one primary insurance can be effective at a time. In this case the Therapy Transaction Date is 2/28/2014 and there is one insurance policy that has an effective date of 1/1/2008 and a termination date of 2/28/2014 and the type is primary. Any suggestions on what I'm missing here?
You can't expect 2/28/2014 to be greater than 2/28/2014.
Perhaps you should add one day so the insurance would still be effective on termination day, i.e. become invalid the next day.