Forum Discussion
Subform Causing ID Index Issue
First, please do NOT alter the table structure. That's not the problem here.
The description you gave is not enough to give you a full answer, but we can discuss the circumstances in general and offer some suggestions for you to follow up on.
First, this sounds like you have a one-to-many relationship between two tables. That's the most likely source of the error which raises the error message you related to us. The problem here is that the way you created this copy didn't account for that relationship.
How it needs to work is this:
The main form is bound to the table on the one-side of a relationship. The sub form is bound to the table on the many-side of that relationship. For example, it could be Orders and the line items in those orders in an OrderDetail table. Each record in the OrderDetail table has a foreign key indicating which order that record belongs to.
There is a pair of properties on the subform control which manages that relationship between the records entered into the main form and the related records in the subform. They are called "Link Master Fields" and "Link Child Fields". That's how you tell the main form and sub form to handle the Primary Key from the one-side table and the Foreign Key(s) from the many-side table.
It sounds like in copying this subform, you didn't set that up properly, or that they weren't changed to reflect the new tables involved.
Start there. If you can't suss out how to fix that, post back with some screenshots of the tables involved and the forms in Design view.
- Brad_OlesonDec 29, 2022Copper Contributor
George_Hepworth
Wow. That was the simplest fix of all time. That was exactly the issue!
Thank you for the input!Brad
- George_HepworthDec 29, 2022Silver ContributorCongratulations on resolving the problem. Continued success with the project.