View Full Version : Error Message: Relationships???


ratata
01-22-2007, 02:55 AM
I get the following error message when trying to enter data into the form i created:

"You cannot add or change a record because a related record is required in table 'Two'."

I have five tables, four of which are one-to-one relationships. The main table ("One") of these four has a one-to-many relationship with table "Five". Something like this:

One---(1-1)---Two---(1-1)---Three---(1-1)---Four
|
---(1-*)---Five

On the form are boxes for data from every table and a subform for the data from table five. Once i have entered data into every field for each of the tables, i try to click on the subform and get the above error. (All relationships have referential integrity). I've attached a file.

If you could find the problem and suggest a solution that would be great. Thanks.

neileg
01-22-2007, 07:02 AM
Few things.

1) You very rarely have a true one to one relationship. Why don't you store all the data from One to Four in one table?

2) You don't join tables PK to PK, you hold the PK of the primary table as a foreign key in the secondary table.

3) Linked to 2 above, the fact that you have the PK of the secondary tables set as an autonumber is only making things worse. In your form, you would create the FK in the secondary tables as you populate the form but this is clashing with the autonumber.