Duplicate Key Error on while updating record


Active Member
Hello Gurus,
I have a very basic interactive application which uses a Headerless Detail Form.
There is no problem when I am adding records to the table - but when I am trying to update a record, it throws me a Duplicate Key Error message.(JAS-MSG317).This is happening on local web/fat client.My table has no older data as I just generated it.
I don't understand that when I am not writing to the table, just updating it, why should I get an error.

I am on Tools Release and App release is E900.
Database is SQLServer 2008R2
Please help me...

Without knowing what your form exactly looks like.. I'm guessing you're missing values for (some of) the table key columns.. Did you check the generated table i/o statement in the logging? Also, check in UTB if you have a record with blank/0 values in the key columns.
It may happen that you are trying to update the table based on secondary index and updating one of the primary key column causing the violation.
Best would be to generate a debug log when you update the record, this log can give you details of what the SQL is generated so you can make out what you are missing in the udpate either wrong index or duplicate key fields. It is also good to post more details so it becomes easy.
Probably you are updating the primary key of the file. Check that.

If your requirement is to update primary key then delete the record from the table before saving the record and then save (press OK button)which will insert record.
Debug it and see if the form mode is actually ADD mode not UPDATE mode

Depending on the form and what options you've ticked/unticked the form will misbehave from what you expect it to do