Arita,
This is one of the things INDEXSEEK( seekvalue, .f., aliasname, tagname ) was designed for.
You can use this function to see if the value already exists before allowing them to exit the control.
>I enter records in a dbf using grid and set allowaddnew property .t.
>The table have two fields - ItemCode and Quantity and Itemcode is indexed as candidate.
>
>Now if I enter a duplicate value in itemcode, the cursor move to quantity field as usual. Then when it leave the quantity field it give a message of duplicate record.
>
>I like to generate my own messagebox, for checking duplicate itemcode just before it leave the itemcode field ie my message box should come before the system messagebox of duplicate itemcode.