You cannot add or change a record because a related record is requ

D

DaybyDay

I am trying to use a form to add entries into a table. When I click the next
record button, I get the following error "You cannot add or change a record
because a related record is required in table 'Table A'. The form adds
entries into Table B, which has referential integrity enforced with Table A.
The data matches in both fields and tables, it is also the only relationship.
I have checked the properties and have not noticed anything that would cause
this error. Form B uses a lookup to enter data into the table.
Any help would be greatly appreciated!
 
J

John Vinson

I am trying to use a form to add entries into a table. When I click the next
record button, I get the following error "You cannot add or change a record
because a related record is required in table 'Table A'. The form adds
entries into Table B, which has referential integrity enforced with Table A.
The data matches in both fields and tables, it is also the only relationship.
I have checked the properties and have not noticed anything that would cause
this error. Form B uses a lookup to enter data into the table.

The Lookup Field is almost certainly the problem, if it's a table
lookup.

You're getting the error because... well, because there is no matching
record in TableA. The simplest way to ensure that the tables are
linked is to use this Form as a Subform, with the parent form based on
TableA. If you have some reason not to do so, you need *some* way to
enter the value of the correct foreign key value (which will be
concealed from your view if you've used a Lookup field in the table)
onto the form.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top