Hi again Cetin,
Thank you very much for the reply...I tried it...with a few
minor adjustments IT WORKED like a dream...
Once again, thank you very much
Fida
>>Hi,
>>
>>Can you please help me with this...
>>
>>I have generated a form with a wizard...
>>I have two fields namely assets and sub-asset.
>>I have a regular index called assetsub which is assets+sub
>>I donot wish to create a primary index because i would like
>>to add a duplicate record through a transfer process..
>>
>>The problem is how do i look for a duplicate...where do i
>>put the code in the buttons...
>>
>>can u please HELP!!
>>
>>Thanks Fida
>Fida,
>Logically what you would do is to check for duplicate, if duplicate behave as if "Revert" is clicked (if you don't want to give user a chance to correct) :
>llDuplicate = .f.
>if this.parent.editmode
>* Assets entered in txtAsset and the other txtSub
>select recno() from (yourtable) ;
> where assets+sub == ;
> padr(thisform.txtAsset.value,fsize("assets",yourtable)," ")+;
> padr(thisform.txtSub.value,fsize("sub_asset",yourtable)," ") ;
> into array aCheck
>* if required use lower, upper etc
>if type("aCheck") = "N"
> for ix = 1 to alen(aCheck,1)
> if aCheck[ix,1] # recno(yourtable)
> llDuplicate = .t.
> exit
> endif
> endfor
>endif
>endif
>if llDuplicate
> this.parent.cmdEdit.click
>else
> dodefault()
>endif
Basic idea is SQL doesn't select from buffers and wizard uses buffered tables (good:).
>Another quick check trick is to "use again" the same table ordered by check tag and do a seek()+scan while..endscan on it (buffered data doesn't exists in table "used again" :).
>Cetin
Wannabe FoxPert!!!