Hi Robert<br>Sorry for some mistakes I made on my post leading to the unclear problem.<br>I will be more carefully and clearer this time.<br><br>RENTSCHEDULE.DBF<br>Fields EQUIPID DATEBEOUT DATEBEIN QUANTITY<br>Rec. 00001 HVA001 09/01/2000 09/28/2000 03<br>Rec. 00002 WSC003 09/04/2000 09/10/2000 02<br>Rec. 00003 HVA001 11/01/2000 11/20/2000 05<br>...<br>Rec. 10000 HZA001 09/01/2000 01/28/2001 01<br><br>EQUIPMENT.DBF<br>Fields EQUIPID INVENT_QUANT<br>Rec. 00001 HVA001 09<br>Rec. 00002 WSC003 10<br>...<br>Rec. 01000 HZA001 01<br><br>When a customer wants to rent equipment, he or she will tell operator:<br>1. equipment ID (variable equip_ID_want)<br>2. date will be pickup (date_out_want) <br>3. date will be returned (date_in_want)<br>4. quantity (variable quant_want)<br>My job is writing a procedure taking those input and checking if that equipment at that range of date is available for rent. If it is available then display message “OK, You can rent it” if not then display a list of equipment was scheduled for rent within the range of date, base on following condition:<br>RENTSCHEDULE.equipid=equip_ID_want and date_out_want>=RENSCHEDULE.datebeout and date_in_want<=RENTSCHEDULE.datebein and quant_want>EQUIPMENT.invent_quant – sum of quantity of the equipment was rent out within that range of date <br>Example1:<br><br>equip_ID_want=”HVA001”<br>date_out_want={09/26/2000}<br>date_in_want={11/12/2000}<br>quant_want=01<br>Will display “OK, you can rent it” (in that range of date, sum of quantity rent out is 8, total inventory is 9, customer want 01)<br><br>Example 2:<br><br>equip_ID_want=”HVA001”<br>date_out_want={08/23/2000}<br>date_in_want={11/02/2000}<br>quant_want=03<br>Will display a list:<br> Rec. 00001 HVA001 09/01/2000 09/28/2000 03<br>Rec. 00003 HVA001 11/01/2000 11/20/2000 05<br> 08<br>(In that range of date, sum of quantity rent out is 8, total inventory is 9, available is 1, and customer wants 03)<br><br>Example 3:<br><br>equip_ID_want=” WSC003”<br>date_out_want={09/01/2000}<br>date_in_want={09/03/2000}<br>quant_want=03<br>Will display “OK, you can rent it”<br> (In that range of date, nobody rent WSC003, sum of quantity rent out is 0, total inventory is 10, available is 10, customer wants 03)<br><br>Hope it is clear<br>Thanks for your time<br>Binh Pham <br><br><br>