Duplicate Key Error on Form

hch

Member
I have a custom table (with primary key composed of 6 columns), view with all columns, and a form over it. When I try to modify one of the non-key fields via the form, I get a duplicate key error. I have tried this with a header detail form and headerless detail form and the error is consistent. I can add a row, but cannot modify. I have looked at the logs, found the keys it is trying to insert, and put them into a SQL statement. Only 1 row is returned. Any ideas?

Thanks!

E91, SQL DB, Windows
 
Look in log around the SQL there should be more info out there on why its failing.

Chan
 
Have you generated the file; To me it looks like it still has some old index rather than the primary key composed of six columns. Regenerate the file and try again.
 
I have a custom table (with primary key composed of 6 columns), view with all columns, and a form over it. When I try to modify one of the non-key fields via the form, I get a duplicate key error. I have tried this with a header detail form and headerless detail form and the error is consistent. I can add a row, but cannot modify. I have looked at the logs, found the keys it is trying to insert, and put them into a SQL statement. Only 1 row is returned. Any ideas?

Thanks!

E91, SQL DB, Windows
Hi.
What this issue ever resolved?
I have the same issue.

In the debug log, the UPDATE SQL statement is missing a key field in the WHERE clause. Thus triggering the duplicate key error. The missing key field is part of the primary key. I've regenerated the table to no avail.

I think the date field (missing key field) was added to the index after the table was created. Someone else created the table and the app.

Does anyone have any ideas?
 
This is on fat client or thin client.
If this is on fat client, try with another fat client ( might be spec issues)
 
Was the table/key modified since the business view was created? Have you tried creating a new business view over the table?
 
Hi.
I don't know. I was parachuted into the project last month. The objects were created by someone who is no longer with the company.

The Add screen uses the same business view as the Update screen and the Add screen is okay.
I am talking to the AS/400 admin about deleting SQL packages.
I will add creating new business view to list of possible solutions.
 
If the form data structures are changed after creation of the forms I've seen this happen.
Only fix was to recreate
 
Hi.
Craig's suggestion worked. I created new business views and attached the new views to the forms. Voila! There were no more duplicate key errors.
 
Was the table/key modified since the business view was created? Have you tried creating a new business view over the table?
This is exactly what you want to do in this case. Even if the existing business view is modified and saved it works
 
Back
Top