Valid date to cannot be less than Valid date from when saving a Raiser’s Edge Membership record

Valid date to cannot be less than Valid date from

I got this error message the other day when developing with the membership module. In my opinion the membership module is the most complicated module to develop code for. Possibly because of this (and the fact that it is an optional module) there appears to be the least documentation about it. When I searched the knowledgebase for this error I did get a hit. It referred to NetSolutions. It suggested that the membership record did not have an expiry date.

This was not the case in my data. I had an activity date and an expiry date as required.

I worked out what the problem was. The issues happened when adding a membership card. I share this code between new memberships and a case where you may want to add a new membership card to an existing transaction. For a new membership card I was setting the card date as the same as the transaction date. The expiry date, by default was being set to the same as the membership’s expiry date. This worked fine for new memberships.

When I went to add a membership card to, say, a lapsed membership, (why this would happen in reality is uncertain but it was happening in my case), the start date was set to the transaction date i.e. today but the expiry date was in the past so the card’s expiry date was also in the past.

I checked for this scenario and set the membership card’s start date to one day before the expiry date if the expiry date was not after the start date.