>Hi Peter,
>
> You seem to be confusing GOTO with LOCATE, SEEK, Etc. GOTO moves to a specific record number in a table, e.g. GOTO 10 moves to the 10th record in the table, not necessarily the record where bm_recid = 10, because as you've said bm_recid can be duplicated or even deleted.
>
>Consider the following scenario:
>
>Deleted bm_recid RECNO()
>.F. 1 1
>.F. 2 2
>.T. 3 3
>.F. 3 4
>
>In the above scenario your code would cause bm_recid of 3 to go to record number 3 which is deleted. Use a SEEK, LOCATE or SCAN FOR using the value of the key field not the record number.
>
>E.g
>
>LOCATE FOR bm_recid = arrBMid(arrCtr)
>
>
>Hope this helps,
>Gavin...
>
>>I have a routine that needs to process unique id's from a table. This table odten has a deleted record for the ID as well as the possibility of multiple records for that ID.
>>
>>What it does is run a:
>>
>>SELECT DISTINCT bm_recid from bmdata to array arrBMid
Try
SELECT DISTINCT bm_recid from bmdata where !DELETED() to array arrBMid
>>
>>Then I step through the array manipulating the data as needed.
>>
>>for arrCtr=1 to alen(arrBMid)
>> goto arrBMid(arrCtr)
>>
>> ---- process record ----
>>
>>endfor
>>
>>
>>The problem is it is pulling the DELETED record if it is there and NOT going to the subsequent record for that ID that is NOT deleted.
>>
>>I finally realized what it was doing and tried a SET DELETED ON before all this to stop that problem... that doesn't work and I thought it should.
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca