ForeignKeyConstraint

D

David A. Osborn

I keep getting the following message when adding a new record to a database
that has two tables. On table is a parent to the other. I am adding a new
parent record that has child records and I get the following:

ForeignKeyConstraint drtblCDstblSongs requires the child key value(9) to
exist in the parent table. Do you want to correct the value? Is there a
way I can just turn this off since with my program the only way to add a
child is to add the parent at the same time.
 
C

Chris

David said:
I keep getting the following message when adding a new record to a database
that has two tables. On table is a parent to the other. I am adding a new
parent record that has child records and I get the following:

ForeignKeyConstraint drtblCDstblSongs requires the child key value(9) to
exist in the parent table. Do you want to correct the value? Is there a
way I can just turn this off since with my program the only way to add a
child is to add the parent at the same time.

You need to add the parent record, then get the value of the foreign
key. then add the child record with using that foreign key. Why do you
want to remove this if it is enforcing your rules?

Chris
 

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