>hello all
>
>I have a grid based on a view and i get this error message when i updated a duplicate record,
>
>Warning The key defined by the keyfield property for table mydbc!table1 is not unique.
>
>Here is a sample data , key field is SSN
>
>Table1
>SSN
>123456789
>123456789
>987654321
>323552345
>
>Second record is a complete duplicate,so users selects it to delete.i just issue =tableupdate(.t.)
>
>but i get this error message.how to avoid this,any workarounds ???
>
>Txs for any help.
Seems like your table got the data before this was assigned as a key, or somehow passed the validation. It shouldn't let you have this in the first place, but there could be some setting I never used which would allow this.
What's happening is that this key is already wrong, but VFP won't complain unless you try to update the record, and deletion counts an update (it writes a "*" into the invisible field which is on the last byte before the first field in each record). You'd have to replace the key with some different value (in case of SSNs, there's a range of impossible values, use one of those) before updating the record, so the keys would be different and the DBC would allow the update.