>The title says it all ; can I use REPLACE (some systemname) to delete records.
>
>Why ?
>
>I have a candidate index on a table. Records are deleted and added to it (wow !). When a record is deleted and later I want to add a record with the same index, the insert is refused because of the uniqueness constraint (as far as the table hasn't been packed since). So to prevent this, before I delete the record, I change a value in the record (using the negative recno() which can never give duplicates) :
>
>REPLACE whatever_part_of_the_index WITH -recno()
>DELETE NEXT 1
>
>So twice access to the table : can I reduce the access to only once ?
Pascal, this is what I do. I use integer fields for keys. When I want to "delete" a record, I set the key value to the negative of itself.
REPLACE TABLE.iKey with -TABLE.iKey.
This will never cause a non-unique value.
I do this for the primary key and all of the foreign keys. I DON'T actually DELETE the record. I have SET DELETED OFF.
Works for me.
Peter
Peter Robinson ** Rodes Design ** Virginia