>I am using Locate Command and if my desired text is found I am doing something, something.
>
>Here is my code
>
>
>If lshiftuppagetworecurringcharges=.T.
>LOCATE For Strextract(ps,'(',')')='RecurringCharges' And PageNo=2
>If Found ()
>nrecurringchargesposr=posr
>Select Distinct posr From pagetwo Order By posr Desc Into Cursor distinctposr
>Locate For posr=nrecurringchargesposr
>Skip-1
>ncommondifferenceforrecurringchargesposr=posr-nrecurringchargesposr-10
>Select pagetwo
>Replace All posr With posr+ncommondifferenceforrecurringchargesposr For posr<=nrecurringchargesposr
>Endif
>Endif
>
>
>My problem is that if the first instance of my required text i.e 'RecurringCharges' in the above case is found True, my Code is executed. However I have many other records later in my cursor for which I have Strextract(ps,'(',')')='RecurringCharges' And the above code does not locates and executes all the 'RecurringCharges'
>
>I need that the Locate for should search till the last existence or occurrence of ‘RecurringCharges’ in my cursor and execute the code if the condition is found true.
>
>What changes I have to do in my above code.
>
>Regards
You might try something like
SCAN FOR Strextract(ps,'(',')')='RecurringCharges' And PageNo=2
code
code
etc.
ENDSCAN