Incorrect search results if searching by date range and any other criteria
I've created a search page that searches records by various criteria and is mostly working fine. However, one of the search criteria is a date range (I'm using the WA Datepicker control for these fields).
If I search for records between 2 specific dates I get the correct results returned. If I search for records using search criteria and not entering any dates I get correct results. If I search for records using a date range and then any other criteria I get all the records returned, not just the correct ones. I've been trying to solve this for all day and so far cannot get it working. It's like the page is ignoring the unique value I also tell it to check for (ACCOUNT_REF) when I use dates and other criteria.
I've attached the two files involved and wonder if anyone can point me in the right direction as to why I'm getting incorrect results.