date criteria generating error

date criteria generating error

In a user defined function the following form criteria generates an error:

  1. apt_rec = Appointments  [((((Client == inv.Client && Appointment_Type == "Assessment") && Cancelled == false) && Start_Date >= inv.InvoiceDate) && Start_Date <= inv.Closed_Date)];

However, the following version (without the end date specified) works fine:

  1. apt_rec = Appointments  [(((Client == inv.Client && Appointment_Type == "Assessment") && Cancelled == false) && Start_Date >= inv.InvoiceDate)];
What is the correct syntax to specify criteria to select records where a date field value is between two dates?