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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Related Record required - but I think I HAVE the related record!

Status
Not open for further replies.

piovesan

Technical User
Jan 23, 2002
159
CA
Hi everyone;

I am at a point where I don't thinkI can see the trees for the forest...so I need a fresh outlook from someone. Here goes:

I have a database that contains many related tables. I have a Project Table that has a Project ID (primary) that related as a one to many relationship with a Project Type table that has a Type ID (primary) and that table relates as a one to many relationship with a Component Description table that has a Component ID (primary). I have forms set up so that as you enter info on the Project Table, and then open the Project Type Form, it automatically enters the Project ID in the Project Type table, etc for the Component Table.

Now, I have a table called Printing Specs which has a one to one relationship with the Component Descritpion table through the Component ID. After inputting what I need on the Component Form, I open the Printing Spec Form and I can enter Printing data as the forms are related through the Component ID.

This is where I lose it. I have another table called Post Production, which I also have a one to one relationship with the Component Description table. But, I open the Post production Form from a command button in the Printing Specs Form. I have the Component ID's as the parent/child links....when I start entering data in the Post Production Form, I can see that my Post Production.Component ID field DOES actually get updated with the proper Component ID, but when I try to save the data, I get an error saying
"you cannot add or change a record because a related record is required in table "Component Description""

What am I doing wrong???

Thanks in advance!
 
Can't be certain without seeingthe flow in code but you may be looking at a sequence issue. By that I mean that the update to "ComponentID" is happening but it has not yet happened when you attempt to add the new record to the child table. That can happen when you have the new data sitting in the output buffer so it looks like its in the database but it really hasn't been written yet. If you are adding it via a recordset then try doing a ".Move 0" on the recordset to force it to write changes to the table.

... or I may be completely out to lunch on this one.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top