Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Message - Cannot add records because a related record...

Status
Not open for further replies.

JTAOne

Vendor
Aug 22, 2003
3
US
I am having a slight challenge. I guess I am having one of those brain cramp days.

Scenario (MS Access 2000 - part of Office 2000, On WIN2k Pro Machine)
1) Master Form with detail pointing to master table.
2) Control button on Master Form which was programmed to bring up second form.
3) Second Form comes up okay and displays correct reference to Master Form (using contactID field and displaying persons name).
4) Check boxes on Second Form for selection criteria, which are referenced to a table containing all the data for the Second Form. This includes a reference and table relationship that correctly mates the two table together.
5) Can select various check boxes, but form data cannot be saved. I get the "Cannot add records because related record is required in table..."
6) As far as I can tell I have the proper links set up.

Any suggestions??
 
Hi

Look at the relationships you have defined (Tools \ Relationships)

you are trying to add a row where a column is defined with a relationship to a column in another table

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Ken,

Thank you for responding to this post. However, I have checked the relationships. They appear to be correct to me.

The fundamental layout for this particular database uses the Contact database setup as a starting point. In this case I have a table relationship from Contacts to M_Plan which happens to be a plan of action for the individual contact. The relationship between these two tables is via the ContactID.

ContactID is the primary key in Contacts and is related to the ContactID field in the M_Plan table (one to many relationship). It is set up very similar to the calls table layout.

The only difference is that on the form that is called to populate the M_plan data, some of it is static on the form itself and other information is obtained via subforms on this form.

Chet
 
Hi

I never suggested the relationship was not 'correct', I was pointing out to you that this is the source of your error, from your more dtailed explanation I would say you are attempting to create a contact with an MPlan code which does not exist in the MPlan table, or you are attempting to create an MPlan row for a contact which does not exist in the Contacts table

Be aware that when using sub forms, the record is updated as soon as you move off that row, OR leave the sub form, it is a common error to attempt to create/update the subform rows before the main form has been saved.

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top