Select Records valid for a Date

Select Records valid for a Date

Hi,

We have a form which has fields such as From_Date, To_Date plus few more. 

This form serves as master data which is used by other forms & application. To get the required information for a specific record from master form for any given date i.e. we would like to search for a record in master table for a date which should fall in between from & to date fields.

We have tried fetch record command ( Xdate >= from_date && Xdate<= To_date)  but it returns a null.
The data in master is like


We would like to get value for  example "Field Name" record for a date say "15.01.2013" and Cap equal to say 16 from above  form by scripting.

Thanks.
P.K.Inani