The "problem" you are seeing is not really a problem. You have a Where clause that tells VFP to replace every record where ID = lcID with a new value. It replaces the record you want and continues to scan the entire table until it finds another instance of lcID (since it's the PK, it doesn't find one).
I know of two (and a half) ways around this.
1. Use the SQL UPDATE command as you are and then do a =seek(lcID, 'customer', 'index name here') to reposition the record pointer.
2. Use the old xBase command REPLACE instead of the SQL UPDATE syntax. This will not move the record pointer at all.
2.5. Use the LOCATE command after the SQL UPDATE command instead of SEEK(). I don't recommend this if your tables are of any size (that's why it's a half solution).
HTH.
>Hi Everyone
>
>I have a table on which I want to UPDATE some fields, I have a primary key ID which I use in the WHERE clause to ensure only the current record is updated. All great except after performing the UPDATE the record pointer moves to the end of the table.
>
>lcID = CUSTOMER.ID
>UPDATE CUSTOMER SET BALANCE = (BALANCE - lyPayments) WHERE ID == lcID
>
>Any Ideas????
>
>TIA
>Justin Lievesley
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao