Add that property to your textbox class. Then when you drop that class on the form, populate that property value with mytablename.ID_fieldname
>Thanks for the reply. I am getting error message "Property CSOURCE is not found". I did add "cSource" in the New Property of the form and changed the ControlSource (of that field) to "m.cSource". I copy/paste the following code in Text1.LostFocus Is that correct?
>
>>If you want to do this, do not bind the control to a field. If you are going to do this regularly, create an ID textbox class with a cSource property:
>>local lcTable, lcField, lnSelect, lnRec, lnID, lnCount
>>lcTable = juststem(alltrim(This.cSource))
>>lcField = justext(alltrim(This.cSource))
>>lnSelect = select()
>>select (lcTable)
>>lnRec = recno()
>>lnID = This.Value
>>count to lnCount for ID = lnID
>>goto lnRec
>>if lnCount > 0
>> ** Duplicate found
>> select (lnSelect)
>> return 0
>>endif
>>** otherwise the count was 0
>>replace &lcField with lnID
>>select (lnSelect)
>>return .t.
Mark McCasland
Midlothian, TX USA