简体   繁体   中英

Access 2010 error when moving focus to subform or acSaveRecord

So I have a Form in Acess 2010 with two subforms to manage one-to-many relationship, for Projects and Tasks, they are bound to two linked tables on SQL Server so whenever I load a project, the tasks are listed on the subform.

Lately I have been encountered an error on primary key violation whenever I move from a field on the main form to any area of the subforms. This tells me that the primary form is trying to save whatever it was loaded, but instead of UPDATE, it's trying to INSERT.

There is no code or event that I can see (like before or after update) that may do that specific command. There is a Save button on the form, this button is using DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 and it produces the same error.

Is there a way to indicate Access to use UPDATE instead of INSERT?

I have been looking all around but don't seem to find any related fix.

Thanks to everyone!

EDIT: I have tried removing the primary key on the linked table and the error goes away, but as suspected, it is inserting duplicates every time I move to a different record or click on the subform. So if anyone have a clue on the record navigation behavior and how to configure it, I would appreciate very much!

如果 SQL 表上有触发器,那么调用 INSERT 语句的可能是触发器而不是前端。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM