>I want to update multiple records in local views by reusing deleted records when possible. I have tried deleting all records in my local view based on its requery of the base table, recalling a record as it is needed for updating the base table, and updating with a replace. When I attempt this I get an error message stating that I have a attempted to add a duplicate primary key. During debug it appears the view record is not updating the same record in the base table, but this doesn't make sense to me, since the primary key in the view should identify the proper record to recall and update.
>
>If you are confused by my description of the problem, your techniques for updating multiple records from a local view with the reuse of deleted records would be very helpful I'm sure.
>
>I certainly appreciate your help.
>
>Thanks in advance.
when you add a record to the VIEW VFP's internal flags mark it as new and VFP doesn't know you already have this PK and tries to add a new one
you have at least 2 options - the simplest is just to use SETFLDSTATE command
and tell VFP that each field is not in an appended record
another is to set the view not to send updates(using CURSORSETPROP) afer you add the record to the view , do a TABLEUPDATE . then reset it to send updates and make whatever changes to the view fields (which will then be updates
note however that second way VFP will "think" someone else updated the table while you were using it
Arnon
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only